costDeflateR is an R package designed to help you deflate currency values across countries and years using GDP deflators and PPP exchange rates from IMF and OECD datasets. It provides tools for adjusting monetary values to a common base, ensuring comparability across time and geography.
# Install from GitHub (if using devtools or remotes)
# remotes::install_github("jrob95/costDeflateR")deflate(): Main function to deflate currency values using GDP deflators and PPP exchange rates. You can use live IMF/ OECD data using theuse_live_data = TRUEdelfator_country_year_combs(): Lists available country-year combinations in the reference datasets.
library(costDeflateR)
# Sample data
data <- data.frame(
country_base = c("USA", "Germany"),
year_base = c(2010, 2015),
country_target = c("France", "Italy"),
year_target = c(2015, 2020),
cost_base = c(100, 200)
)
# Deflate currency values
deflated_data <- deflate(
input_data = data,
cost_base = "cost_base",
year_base = "year_base",
country_base = "country_base",
year_target = "year_target",
country_target = "country_target"
)
print(deflated_data)deflated_data <- deflate(
cost_base = c(100, 200),
year_base = 2010,
country_base = "Australia",
year_target = 2020,
country_target = "United States",
rename_countries = TRUE
)
print(deflated_data)You might not know which year/ country combinations have data present in
your PPPEX and NGDP_D combination choice.
delfator_country_year_combs() lets you check.
delfator_country_year_combs(pppex_src = "IMF")Feel free to open issues or submit pull requests. Contributions are welcome!
LGPL-3.0 © Jack Roberts and Ian Shemilt