21 lines
524 B
R
21 lines
524 B
R
# 02_convert_currency.R
|
|
# Reads wide-format income CSV, converts EUR to USD. Stays wide.
|
|
# In a real pipeline the exchange rate could be fetched from an API.
|
|
|
|
source("scripts/00_paths.R")
|
|
|
|
library(readr)
|
|
library(dplyr)
|
|
|
|
df <- read_csv(income_raw, show_col_types = FALSE)
|
|
|
|
df_usd <- df |>
|
|
mutate(
|
|
across(jan:jun, ~ round(.x * euro_to_dollar_conversion_ratio, 2)),
|
|
denomination = "usd"
|
|
)
|
|
|
|
write_csv(df_usd, income_usd_wide)
|
|
|
|
cat("02_convert_currency.R: EUR -> USD conversion done, wrote df_income_usd_wide.csv\n")
|