Initial commit: illustrative R data pipeline
This commit is contained in:
20
scripts/03_convert_currency.R
Normal file
20
scripts/03_convert_currency.R
Normal file
@@ -0,0 +1,20 @@
|
||||
# 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")
|
||||
Reference in New Issue
Block a user