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/07_calc.R Normal file
View File

@@ -0,0 +1,18 @@
# 05_calc.R
# Reads merged data and calculates income per person.
source("scripts/00_paths.R")
library(readr)
library(dplyr)
df_merged <- read_csv(merged, show_col_types = FALSE)
df_result <- df_merged |>
mutate(income_per_person = round(value_usd / population, 4)) |>
select(month, value_usd, population, income_per_person)
write_csv(df_result, result)
cat("05_calc.R: calculated income per person, wrote df_result.csv\n")
print(df_result)