-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
139 lines (82 loc) · 3.46 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
104
105
106
107
108
109
110
111
112
113
114
---
output: github_document
always_allow_html: true
---
<!-- 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%"
)
```
# epuR
<img src="inst/figures/epuR_logo.png" height="200" align="right" />
<!-- badges: start -->
[](https://travis-ci.org/Lingbing/epuR)
[](https://cran.r-project.org/package=epuR)
[](https://cran.r-project.org/package=epuR)
[](https://cran.r-project.org/package=epuR)


[](http://hits.dwyl.com/lingbing/epuR)
<!-- badges: end -->
The goal of `epuR` is to provide a simple and consistent framework to collect Economic Policy Uncertainty and related index data from their official web locations in real time.
The official websites are listed here:
Economic Policy Uncertainty:https://www.policyuncertainty.com/china_monthly.html.
Trade Policy Uncertainty:
https://www.matteoiacoviello.com/tpu.htm#data
Oxford-Man Institute Realized Volatility:
https://realized.oxford-man.ox.ac.uk/
Geopolitical Risk Index:
https://www.matteoiacoviello.com/gpr.htm
## Installation
You can install the released version of `epuR` from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("epuR")
```
And the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("Lingbing/epuR")
```
## Example
`epuR` functions adopts a **get_XXX()** style to collect the index data, where 'XXX' refers to the index name. For example, to get the Economic Policy Uncertainty (EPU) index, use function `get_EPU()`:
```{r example}
library(epuR)
## get EPU data
epu_data <- get_EPU()
class(epu_data)
```
Every `get` function returns an `xts` time series object so that further data manipulation and visualization is very straightforward if you are familiar with operations on `xts`. To plot all regions in the EPU data:
```{r cars}
plot(epu_data)
```
To plot some specific region:
```{r}
plot(epu_data$Australia)
```
## Using `dygraphs`
`dygraphs` can be directly employed to make the time series plot interactive:
```{r}
library(dygraphs)
dygraph(epu_data$China)
```
Currently, the following indexes are supported:
## Supported Index
| Function | Index Data | Default arguments |
|:---------:|:---------------------------:|-------------------|
| `get_EPU` | Economic Policy Uncertainty | region = "all" |
| `get_EMV` | Equity Market Volatility | all = T |
| `get_FSI` | Financial Stress Indicator | freq = "monthly" |
| `get_GPR` | Geopolitical Risk Index | type = 1 |
| `get_IRI` | Immigration Related Index | region = "all" |
| `get_TPU` | Trade Policy Uncertainty | region = "China" |
| `get_WUI` | World Uncertainty Index | type = "F1" |
| `get_OMI` | Oxford-Man Institute RV | index = "AEX" |
For example, to get the FSI data:
```{r}
fsi_data <- get_FSI()
dygraph(fsi_data)
```