GDPuc

CRAN status R-CMD-check codecov Lifecycle: stable

GDPuc (a.k.a. the GDP unit-converter) provides a simple function to convert GDP time-series data from one unit to another.

To note: The default conversion parameters are from the World Bank’s World Development Indicators (WDI) database (see link). The current parameters are from October 2021, with the next update planned for October 2022.

Installation

# Install from CRAN
install.packages("GDPuc")

# Or the development version from GitHub
remotes::install_github("johanneskoch94/GDPuc")

Usage

Load the package.

library(GDPuc)

The main function of the package is convertGDP.

convertGDP(
  gdp = my_gdp, 
  unit_in = "constant 2005 LCU", 
  unit_out = "constant 2017 Int$PPP"
)

Here, the gdp argument takes a tibble or a data-frame that contains, at least:

The unit_in and unit_out arguments specify the incoming and outgoing GDP units. All common GDP units are supported, i.e.:

Here “YYYY” is a placeholder for a year, e.g. “2010” or “2015”, and “LCU” stands for Local Currency Unit.

Example

library(GDPuc)

my_gdp <- tibble::tibble(
  iso3c = "USA", 
  year = 2010:2014, 
  value = 100:104
)
print(my_gdp)
#> # A tibble: 5 × 3
#>   iso3c  year value
#>   <chr> <int> <int>
#> 1 USA    2010   100
#> 2 USA    2011   101
#> 3 USA    2012   102
#> 4 USA    2013   103
#> 5 USA    2014   104

convertGDP(
  gdp = my_gdp, 
  unit_in = "constant 2005 LCU", 
  unit_out = "constant 2017 Int$PPP"
)
#> # A tibble: 5 × 3
#>   iso3c  year value
#>   <chr> <int> <dbl>
#> 1 USA    2010  123.
#> 2 USA    2011  124.
#> 3 USA    2012  126.
#> 4 USA    2013  127.
#> 5 USA    2014  128.

Further Options

convertGDP has other arguments that allow you to: