Skip to content

jrob95/costDeflateR

Repository files navigation

costDeflateR

Codecov test coverage Lifecycle: experimental CRAN status R-CMD-check

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.

Installation

# Install from GitHub (if using devtools or remotes)
# remotes::install_github("jrob95/costDeflateR")

Features

  • deflate(): Main function to deflate currency values using GDP deflators and PPP exchange rates. You can use live IMF/ OECD data using the use_live_data = TRUE
  • delfator_country_year_combs(): Lists available country-year combinations in the reference datasets.

Example Usage

Deflating Currency Values

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)

Using Constant Values

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)

Helper Functions

Available Country-Year Combinations

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")

Data Sources

  • IMF World Economic Outlook (WEO) Link
  • OECD PPP Exchange Rates Link

Contributing

Feel free to open issues or submit pull requests. Contributions are welcome!

License

LGPL-3.0 © Jack Roberts and Ian Shemilt

About

Deflate currency values using IMF or OECD Purchasing power parity exchange rates and GDP deflators

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages