| Title: | Inflation Adjustment for Historical Currency Values |
|---|---|
| Description: | Convert historical monetary values into their present-day equivalents using bundled CPI (Consumer Price Index) and GDP deflator data sourced from the World Bank Development Indicators. Supports British pounds (GBP), Australian dollars (AUD), US dollars (USD), Euro (EUR), Canadian dollars (CAD), Japanese yen (JPY), Chinese yuan (CNY), Swiss francs (CHF), New Zealand dollars (NZD), Indian rupees (INR), South Korean won (KRW), Brazilian reais (BRL), and Norwegian krone (NOK). Currency codes and country names are both accepted as input. |
| Authors: | Charles Coverdale [aut, cre] |
| Maintainer: | Charles Coverdale <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.0 |
| Built: | 2026-05-30 15:06:43 UTC |
| Source: | https://github.com/charlescoverdale/inflater |
Converts an amount from a historical year into its equivalent value in a target year, using bundled CPI data sourced from the World Bank Development Indicators. Supports GBP, AUD, USD, EUR, CAD, JPY, CNY, CHF, NZD, INR, KRW, BRL, and NOK.
adjust_inflation(amount, from_year, currency, to_year = NULL, round = 2)adjust_inflation(amount, from_year, currency, to_year = NULL, round = 2)
amount |
Numeric (scalar or vector). The original monetary amount(s). |
from_year |
Integer. The year the amount is from. |
currency |
Character. A currency code or country name. Accepted codes:
|
to_year |
Integer. The target year to adjust to. Defaults to the latest available year in the data. |
round |
Integer or |
A numeric value (or vector) representing the inflation-adjusted amount.
Other CPI adjustment:
historical_value()
# What is £12 from 1963 worth today? adjust_inflation(12, 1963, "GBP") # What is AUD 50 from 1980 worth in 2000? adjust_inflation(50, 1980, "AUD", to_year = 2000) # Full precision adjust_inflation(100, 2000, "USD", to_year = 2020, round = NULL)# What is £12 from 1963 worth today? adjust_inflation(12, 1963, "GBP") # What is AUD 50 from 1980 worth in 2000? adjust_inflation(50, 1980, "AUD", to_year = 2000) # Full precision adjust_inflation(100, 2000, "USD", to_year = 2020, round = NULL)
Converts an amount between two years using GDP deflator data sourced from
the World Bank Development Indicators (indicator: NY.GDP.DEFL.ZS). Suitable
for adjusting GDP figures, government expenditure, and other macroeconomic
aggregates. For adjusting personal or consumer values (wages, prices of goods),
use adjust_inflation which uses CPI instead.
adjust_real(amount, from_year, currency, to_year = NULL, round = 2)adjust_real(amount, from_year, currency, to_year = NULL, round = 2)
amount |
Numeric (scalar or vector). The original monetary amount(s). |
from_year |
Integer. The year the amount is from. |
currency |
Character. A currency code or country name. Accepted codes:
|
to_year |
Integer. The target year to adjust to. Defaults to the latest available year in the deflator series. |
round |
Integer or |
The GDP deflator measures price changes across all goods and services produced in an economy, unlike CPI which tracks a fixed consumer basket. Key differences from CPI:
Covers all domestic production, not just consumer goods
Excludes imported goods (CPI includes them)
Updates its basket automatically (CPI uses a fixed basket)
Published annually/quarterly (CPI is monthly)
Use the GDP deflator when comparing macroeconomic aggregates (GDP, government
spending, investment) across time. Use adjust_inflation for
personal or consumer values.
A numeric value (or vector) representing the deflator-adjusted amount.
Other GDP deflator adjustment:
historical_real()
# Adjust UK GDP from 1990 to today using GDP deflator adjust_real(500000, 1990, "GBP") # Compare US government spending in 2000 vs 2020 terms adjust_real(1000000, 2000, "USD", to_year = 2020)# Adjust UK GDP from 1990 to today using GDP deflator adjust_real(500000, 1990, "GBP") # Compare US government spending in 2000 vs 2020 terms adjust_real(1000000, 2000, "USD", to_year = 2020)
Annual Consumer Price Index for Australia, sourced from the World Bank Development Indicators (indicator: FP.CPI.TOTL). Rescaled so that 2020 = 100.
aud_cpiaud_cpi
A data frame with 65 rows and 2 columns:
Calendar year (integer)
CPI index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/FP.CPI.TOTL
Annual GDP deflator for Australia, sourced from the World Bank Development Indicators (indicator: NY.GDP.DEFL.ZS). Rescaled so that 2020 = 100.
aud_gdp_defaud_gdp_def
A data frame with 65 rows and 2 columns:
Calendar year (integer)
GDP deflator index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/NY.GDP.DEFL.ZS
Annual Consumer Price Index for Brazil, sourced from the World Bank Development Indicators (indicator: FP.CPI.TOTL). Rescaled so that 2020 = 100. Data availability begins in 1980.
brl_cpibrl_cpi
A data frame with 45 rows and 2 columns:
Calendar year (integer)
CPI index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/FP.CPI.TOTL
Annual GDP deflator for Brazil, sourced from the World Bank Development Indicators (indicator: NY.GDP.DEFL.ZS). Rescaled so that 2020 = 100.
brl_gdp_defbrl_gdp_def
A data frame with 65 rows and 2 columns:
Calendar year (integer)
GDP deflator index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/NY.GDP.DEFL.ZS
Annual Consumer Price Index for Canada, sourced from the World Bank Development Indicators (indicator: FP.CPI.TOTL). Rescaled so that 2020 = 100.
cad_cpicad_cpi
A data frame with 65 rows and 2 columns:
Calendar year (integer)
CPI index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/FP.CPI.TOTL
Annual GDP deflator for Canada, sourced from the World Bank Development Indicators (indicator: NY.GDP.DEFL.ZS). Rescaled so that 2020 = 100.
cad_gdp_defcad_gdp_def
A data frame with 65 rows and 2 columns:
Calendar year (integer)
GDP deflator index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/NY.GDP.DEFL.ZS
Annual Consumer Price Index for Switzerland, sourced from the World Bank Development Indicators (indicator: FP.CPI.TOTL). Rescaled so that 2020 = 100.
chf_cpichf_cpi
A data frame with 65 rows and 2 columns:
Calendar year (integer)
CPI index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/FP.CPI.TOTL
Annual GDP deflator for Switzerland, sourced from the World Bank Development Indicators (indicator: NY.GDP.DEFL.ZS). Rescaled so that 2020 = 100.
chf_gdp_defchf_gdp_def
A data frame with 65 rows and 2 columns:
Calendar year (integer)
GDP deflator index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/NY.GDP.DEFL.ZS
Annual Consumer Price Index for China, sourced from the World Bank Development Indicators (indicator: FP.CPI.TOTL). Rescaled so that 2020 = 100. Data availability begins in 1986.
cny_cpicny_cpi
A data frame with 39 rows and 2 columns:
Calendar year (integer)
CPI index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/FP.CPI.TOTL
Annual GDP deflator for China, sourced from the World Bank Development Indicators (indicator: NY.GDP.DEFL.ZS). Rescaled so that 2020 = 100.
cny_gdp_defcny_gdp_def
A data frame with 65 rows and 2 columns:
Calendar year (integer)
GDP deflator index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/NY.GDP.DEFL.ZS
Annual Consumer Price Index for Germany, used as a proxy for the Euro (EUR). Sourced from the World Bank Development Indicators (indicator: FP.CPI.TOTL). Rescaled so that 2020 = 100.
eur_cpieur_cpi
A data frame with 65 rows and 2 columns:
Calendar year (integer)
CPI index value (numeric, base 2020 = 100)
Note: The Euro area aggregate is not available in WDI. Germany is used as a proxy as it is the largest Eurozone economy and was the monetary anchor (Deutsche Mark) prior to the Euro's introduction in 1999.
World Bank Open Data https://data.worldbank.org/indicator/FP.CPI.TOTL
Annual GDP deflator for Germany, used as a proxy for the Euro (EUR). Sourced from the World Bank Development Indicators (indicator: NY.GDP.DEFL.ZS). Rescaled so that 2020 = 100.
eur_gdp_defeur_gdp_def
A data frame with 65 rows and 2 columns:
Calendar year (integer)
GDP deflator index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/NY.GDP.DEFL.ZS
Takes a monetary amount from a recent year and returns what it would have
been worth in a specified historical year, using GDP deflator data sourced
from the World Bank Development Indicators (indicator: NY.GDP.DEFL.ZS).
This is the inverse of adjust_real.
historical_real(amount, to_year, currency, from_year = NULL, round = 2)historical_real(amount, to_year, currency, from_year = NULL, round = 2)
amount |
Numeric (scalar or vector). The monetary amount(s) in the reference year. |
to_year |
Integer. The historical year to convert back to. |
currency |
Character. Currency code ( |
from_year |
Integer. The year the amount is from. Defaults to the latest year available in the deflator series. |
round |
Integer or |
For converting consumer or personal values, use
historical_value which uses CPI instead.
A numeric value (or vector) representing the historical equivalent amount.
Other GDP deflator adjustment:
adjust_real()
# What would UK GDP of £2 trillion today have been in 1990 terms? historical_real(2e12, 1990, "GBP") # What would USD 1 trillion in 2020 have been worth in 2000? historical_real(1e12, 2000, "USD", from_year = 2020)# What would UK GDP of £2 trillion today have been in 1990 terms? historical_real(2e12, 1990, "GBP") # What would USD 1 trillion in 2020 have been worth in 2000? historical_real(1e12, 2000, "USD", from_year = 2020)
Takes a monetary amount from a recent year and returns what it would have been worth in a specified historical year, using bundled CPI data sourced from the World Bank Development Indicators. Supports GBP, AUD, USD, EUR, CAD, JPY, CNY, CHF, NZD, INR, KRW, BRL, and NOK.
historical_value(amount, to_year, currency, from_year = NULL, round = 2)historical_value(amount, to_year, currency, from_year = NULL, round = 2)
amount |
Numeric (scalar or vector). The monetary amount(s) in the reference year. |
to_year |
Integer. The historical year to convert back to. |
currency |
Character. Currency code ( |
from_year |
Integer. The year the amount is from. Defaults to the latest year available in the data. |
round |
Integer or |
A numeric value (or vector) representing the historical equivalent amount.
Other CPI adjustment:
adjust_inflation()
# What would £100 today have been worth in 1963? historical_value(100, 1963, "GBP") # What would USD 500 in 2020 have been worth in 1980? historical_value(500, 1980, "USD", from_year = 2020)# What would £100 today have been worth in 1963? historical_value(100, 1963, "GBP") # What would USD 500 in 2020 have been worth in 1980? historical_value(500, 1980, "USD", from_year = 2020)
Returns the cumulative or annualised inflation rate between two years, using bundled CPI data sourced from the World Bank Development Indicators.
inflation_rate(from_year, to_year = NULL, currency, annualise = FALSE)inflation_rate(from_year, to_year = NULL, currency, annualise = FALSE)
from_year |
Integer. The starting year. |
to_year |
Integer. The ending year. Defaults to the latest available year in the data. |
currency |
Character. A currency code or country name (case-insensitive).
See |
annualise |
Logical. If |
A numeric value representing the inflation rate as a proportion (e.g. 0.35 means 35\
# Cumulative US inflation from 2000 to 2020 inflation_rate(2000, 2020, "USD") # Annualised UK inflation from 1990 to 2020 inflation_rate(1990, 2020, "GBP", annualise = TRUE)# Cumulative US inflation from 2000 to 2020 inflation_rate(2000, 2020, "USD") # Annualised UK inflation from 1990 to 2020 inflation_rate(1990, 2020, "GBP", annualise = TRUE)
Annual Consumer Price Index for India, sourced from the World Bank Development Indicators (indicator: FP.CPI.TOTL). Rescaled so that 2020 = 100.
inr_cpiinr_cpi
A data frame with 65 rows and 2 columns:
Calendar year (integer)
CPI index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/FP.CPI.TOTL
Annual GDP deflator for India, sourced from the World Bank Development Indicators (indicator: NY.GDP.DEFL.ZS). Rescaled so that 2020 = 100.
inr_gdp_definr_gdp_def
A data frame with 65 rows and 2 columns:
Calendar year (integer)
GDP deflator index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/NY.GDP.DEFL.ZS
Annual Consumer Price Index for Japan, sourced from the World Bank Development Indicators (indicator: FP.CPI.TOTL). Rescaled so that 2020 = 100.
jpy_cpijpy_cpi
A data frame with 65 rows and 2 columns:
Calendar year (integer)
CPI index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/FP.CPI.TOTL
Annual GDP deflator for Japan, sourced from the World Bank Development Indicators (indicator: NY.GDP.DEFL.ZS). Rescaled so that 2020 = 100.
jpy_gdp_defjpy_gdp_def
A data frame with 65 rows and 2 columns:
Calendar year (integer)
GDP deflator index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/NY.GDP.DEFL.ZS
Annual Consumer Price Index for South Korea, sourced from the World Bank Development Indicators (indicator: FP.CPI.TOTL). Rescaled so that 2020 = 100.
krw_cpikrw_cpi
A data frame with 65 rows and 2 columns:
Calendar year (integer)
CPI index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/FP.CPI.TOTL
Annual GDP deflator for South Korea, sourced from the World Bank Development Indicators (indicator: NY.GDP.DEFL.ZS). Rescaled so that 2020 = 100.
krw_gdp_defkrw_gdp_def
A data frame with 65 rows and 2 columns:
Calendar year (integer)
GDP deflator index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/NY.GDP.DEFL.ZS
Returns a data frame showing all supported currencies, the country they represent, and the year range available for both CPI and GDP deflator data.
list_currencies()list_currencies()
A data frame with columns:
ISO currency code (character)
Country or area name (character)
First year of CPI data (integer)
Last year of CPI data (integer)
First year of GDP deflator data (integer)
Last year of GDP deflator data (integer)
list_currencies()list_currencies()
Annual Consumer Price Index for Norway, sourced from the World Bank Development Indicators (indicator: FP.CPI.TOTL). Rescaled so that 2020 = 100.
nok_cpinok_cpi
A data frame with 65 rows and 2 columns:
Calendar year (integer)
CPI index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/FP.CPI.TOTL
Annual GDP deflator for Norway, sourced from the World Bank Development Indicators (indicator: NY.GDP.DEFL.ZS). Rescaled so that 2020 = 100.
nok_gdp_defnok_gdp_def
A data frame with 65 rows and 2 columns:
Calendar year (integer)
GDP deflator index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/NY.GDP.DEFL.ZS
Annual Consumer Price Index for New Zealand, sourced from the World Bank Development Indicators (indicator: FP.CPI.TOTL). Rescaled so that 2020 = 100.
nzd_cpinzd_cpi
A data frame with 65 rows and 2 columns:
Calendar year (integer)
CPI index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/FP.CPI.TOTL
Annual GDP deflator for New Zealand, sourced from the World Bank Development Indicators (indicator: NY.GDP.DEFL.ZS). Rescaled so that 2020 = 100.
nzd_gdp_defnzd_gdp_def
A data frame with 65 rows and 2 columns:
Calendar year (integer)
GDP deflator index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/NY.GDP.DEFL.ZS
Annual Consumer Price Index for the United Kingdom, sourced from the World Bank Development Indicators (indicator: FP.CPI.TOTL). Rescaled so that 2020 = 100.
uk_cpiuk_cpi
A data frame with 65 rows and 2 columns:
Calendar year (integer)
CPI index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/FP.CPI.TOTL
Annual GDP deflator for the United Kingdom, sourced from the World Bank
Development Indicators (indicator: NY.GDP.DEFL.ZS). Rescaled so that 2020 = 100.
Use for adjusting macroeconomic aggregates (GDP, government spending, investment).
For consumer values, use uk_cpi instead.
uk_gdp_defuk_gdp_def
A data frame with 65 rows and 2 columns:
Calendar year (integer)
GDP deflator index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/NY.GDP.DEFL.ZS
Annual Consumer Price Index for the United States, sourced from the World Bank Development Indicators (indicator: FP.CPI.TOTL). Rescaled so that 2020 = 100.
usd_cpiusd_cpi
A data frame with 65 rows and 2 columns:
Calendar year (integer)
CPI index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/FP.CPI.TOTL
Annual GDP deflator for the United States, sourced from the World Bank Development Indicators (indicator: NY.GDP.DEFL.ZS). Rescaled so that 2020 = 100.
usd_gdp_defusd_gdp_def
A data frame with 65 rows and 2 columns:
Calendar year (integer)
GDP deflator index value (numeric, base 2020 = 100)
World Bank Open Data https://data.worldbank.org/indicator/NY.GDP.DEFL.ZS