if (FALSE) {
library(dplyr)
sales_transactions <- tibble(
local_price = c(100, 80, 9200, 90),
local_currency = c("USD", "EUR", "JPY", "USD"),
final_currency = c("EUR", "USD", "USD", "JPY"),
date_transaction = lubridate::ymd(c(20200601, 20200609, 20200614, 20200623))
)
# Some made-up sales transactions of different values and currencies
sales_transactions %>%
mutate(
converted_price = convert_currencies(
price_start = local_price,
from = local_currency,
to = final_currency,
date = date_transaction
)
)
}
Run the code above in your browser using DataLab