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