Initial commit: illustrative R data pipeline

This commit is contained in:
2026-03-09 14:20:10 -04:00
commit 83e50d2c36
12 changed files with 277 additions and 0 deletions

18
scripts/06_merge.R Normal file
View File

@@ -0,0 +1,18 @@
# 04_merge.R
# Merges processed income (long, USD) and population (long, full units) on month.
source("scripts/00_paths.R")
library(readr)
library(dplyr)
df_income <- read_csv(income_usd, show_col_types = FALSE)
df_pop <- read_csv(population_full, show_col_types = FALSE) |>
select(month, population = value)
df_merged <- df_income |>
left_join(df_pop, by = "month")
write_csv(df_merged, merged)
cat("05_merge.R: joined income and population, wrote df_merged.csv\n")