24 lines
496 B
R
24 lines
496 B
R
# 03_convert_units.R
|
|
# Reads wide-format population CSV, pivots to long, converts thousands to
|
|
# full unit count.
|
|
|
|
source("scripts/00_paths.R")
|
|
|
|
|
|
df <- read_csv(population_raw, show_col_types = FALSE)
|
|
|
|
df_long <- df |>
|
|
pivot_longer(
|
|
cols = jan:jun,
|
|
names_to = "month",
|
|
values_to = "value"
|
|
) |>
|
|
mutate(
|
|
value = value * 1000,
|
|
unit = "persons"
|
|
)
|
|
|
|
write_csv(df_long, population_full)
|
|
|
|
cat("04_convert_units.R: thousands -> persons, wrote df_population_full.csv\n")
|