Initial commit: illustrative R data pipeline
This commit is contained in:
18
scripts/06_merge.R
Normal file
18
scripts/06_merge.R
Normal 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")
|
||||
Reference in New Issue
Block a user