forked from pik-piam/GDPuc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
103 lines (72 loc) · 3.13 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---
output: github_document
always_allow_html: yes
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# GDPuc
<!-- badges: start -->
[](https://CRAN.R-project.org/package=GDPuc) [](https://github.com/pik-piam/GDPuc/actions/workflows/R-CMD-check.yaml) [](https://app.codecov.io/gh/pik-piam/GDPuc) 
<!-- badges: end -->
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](https://databank.worldbank.org/source/world-development-indicators)). The current parameters are from **October 2021**, with the next update planned for October 2022.
## Installation
```{r, eval = FALSE}
# Install from CRAN
install.packages("GDPuc")
# Or the development version from GitHub
remotes::install_github("pik-piam/GDPuc")
```
## Usage
Load the package.
```{r eval=FALSE}
library(GDPuc)
```
The main function of the package is `convertGDP`.
```{r usage1, eval=FALSE}
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.
## Example
```{r example1}
library(GDPuc)
my_gdp <- tibble::tibble(
iso3c = "USA",
year = 2010:2014,
value = 100:104
)
print(my_gdp)
convertGDP(
gdp = my_gdp,
unit_in = "constant 2005 LCU",
unit_out = "constant 2017 Int$PPP"
)
```
## Further Options
`convertGDP` has other arguments that allow you to:
- choose conversion factors (see ["Choosing conversion factors"](https://pik-piam.github.io/GDPuc/articles/source.html))
- print out information on the conversion process and/or return the conversion factors used (see ["Getting information on the conversion process"](https://pik-piam.github.io/GDPuc/articles/verbose.html))
- handle missing conversion factors (see ["Handling missing conversion factors"](https://pik-piam.github.io/GDPuc/articles/handle_NAs.html))
- convert regional GDP data (see ["Converting regional GDP data"](https://pik-piam.github.io/GDPuc/articles/with_regions.html))