MyNixOS website logo
Description

Easily Convert GDP Data.

Convert GDP time series data from one unit to another. All common GDP units are included, i.e. current and constant local currency units, US$ via market exchange rates and international dollars via purchasing power parities.

GDPuc

CRANstatus 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 April 30th 2024, with the next update planned for April 2026.

Installation

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

# Or the development version from GitHub
remotes::install_github("pik-piam/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:

  • a column with iso3c country codes, (ideally named “iso3c”),
  • a column with the year, (ideally named “year”),
  • a column named “value”, with the gdp data.

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

  • current LCU
  • current US$MER
  • current Int$PPP
  • constant YYYY LCU
  • constant YYYY US$MER
  • constant YYYY Int$PPP

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

For a quick conversion of a single value use convertSingle.

convertSingle(
  x = 100,
  iso3c = "FRA",
  year = 2000,
  unit_in = "current LCU",
  unit_out = "constant 2017 Int$PPP"
)

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.

convertSingle(
  x = 100,
  iso3c = "USA",
  year = 2010,
  unit_in = "current LCU",
  unit_out = "constant 2017 Int$PPP"
)
#> [1] 112.0447

# When converting between constant currencies, the year of the GDP value is not important,
# and can be left out.
convertSingle(
  x = 100,
  iso3c = "USA",
  unit_in = "constant 2005 LCU",
  unit_out = "constant 2017 Int$PPP"
)
#> [1] 123.1357

Further Options

convertGDP has other arguments that allow you to:

Metadata

Version

1.0.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows