Skip to content

API Wrapper for Comex Trade Data

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

datapumpernickel/comRex

Repository files navigation

comRex

The goal of comRex is to provide a very simple wrapper for the new SDMX API of Eurostat, specifically the Comext database, which is not yet covered in the wonderful eurostat-package package, nor in the restatapi-package.

Installation

You can install the development version of comRex like so:

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:

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:

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.

About

API Wrapper for Comex Trade Data

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages