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

20
scripts/04_pivot_income.R Normal file
View File

@@ -0,0 +1,20 @@
# 03_pivot_income.R
# Reads wide-format income (USD), pivots to long format.
source("scripts/00_paths.R")
library(readr)
library(tidyr)
df <- read_csv(income_usd_wide, show_col_types = FALSE)
df_long <- df |>
pivot_longer(
cols = jan:jun,
names_to = "month",
values_to = "value_usd"
)
write_csv(df_long, income_usd)
cat("03_pivot_income.R: wide -> long, wrote df_income_usd.csv\n")