-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
62 lines (40 loc) · 2.37 KB
/
README.Rmd
File metadata and controls
62 lines (40 loc) · 2.37 KB
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
---
output: github_document
---
# comRex <img src="man/figures/logo.png" align="right" height="139" />
<!-- badges: start -->
<!-- badges: end -->
The goal of comRex is to provide a very simple wrapper for the new [SDMX API of Eurostat](https://wikis.ec.europa.eu/display/EUROSTATHELP/API+-+Detailed+guidelines+-+DS-+prefixed+datasets+from+Comext+database), specifically the Comext database, which is not yet covered in the wonderful [eurostat](https://github.com/rOpenGov/eurostat)-package package, nor in the [restatapi](https://github.com/eurostat/restatapi)-package.
## Installation
You can install the development version of comRex like so:
``` r
devtools::install_github("datapumpernickel/comRex")
```
The package is currenty only implementing access to the probably most commonly used dataset by Eurostat, which is "EU trade since 2002 by HS2-4-6 and CN8 (new content) (ds-059322)". The methodology can be found here: https://ec.europa.eu/eurostat/cache/metadata/en/ext_go_detail_sims.htm
## Usage
This is a basic example which shows you how to solve a common problem:
```{r, eval=F}
library(comRex)
data <- cr_get_data(
freq = "A",
reporter = "DE",
partner = NULL,
product = "2701",
indicators = NULL,
time = NULL,
flow = "1",
update = F,
verbose = T,
ds_id="045409")
```
## Controlled vocabularies
The respective arguments all have controllec vocabularies, which you can check by looking ab the argument in this functions:
```{r, eval = F}
products <- cr_get_ref_table("product")
valid_codes <- products$code
```
In all cases, the variable `code` contains the valid codes, whereas there is descriptions, which you can later merge back to the dataset, to get a more nicely formatted dataset.
If you leave an argument on `NULL`, all possible values will be returned.
This is under development, but most likely will only be used as is to get quick access to larger amounts of data.
## Asychronous evaluation
Comext might sometimes not return the data, but tell you that it will be provided asynchroniously, in that case, the package will backoff for 30 seconds and for each additional attempt wait an additional 30 seconds. So after the first time 30 seconds, then 60, then 90 and so on. When you chain a lot of calls into one, you might want to think about just making all the calls at once and then returning at a later time. This is still not properly implemented.