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

26
scripts/01_create_data.R Normal file
View File

@@ -0,0 +1,26 @@
# 01_create_data.R
# Creates two wide-format CSV files: income (euros) and population.
# Wide format mirrors how accountants typically lay out data in Excel —
# one row per entity, months as columns.
source("scripts/00_paths.R")
source("scripts/00_paths.R")
library(tibble)
library(readr)
df_income <- tribble(
~id, ~category, ~denomination, ~jan, ~feb, ~mar, ~apr, ~may, ~jun,
1, "income", "euro", 42000, 39500, 44200, 41800, 43100, 40600
)
df_population <- tribble(
~state, ~category, ~unit, ~jan, ~feb, ~mar, ~apr, ~may, ~jun,
"FL", "population", "thousands", 22600, 22600, 22650, 22650, 22700, 22700
)
write_csv(df_income, income_raw)
write_csv(df_population, population_raw)
cat("01_create_data.R: wrote df_income.csv and df_population.csv\n")