Skip to content

SDMX Connector for R (RJSDMX)

Attilio Mattiocco edited this page Feb 27, 2024 · 9 revisions

RJSDMX is a standard R package.

All the instructions that follow refer to linux.


How to build it

The package sources are in the RJSDMX subtree of the project

  1. If you want to build the java library, see Java SDMX library)

  2. Check the package: from the package sources parent directory type:
    R CMD check RJSDMX

  3. Build the package: from the package sources parent directory type:
    R CMD build RJSDMX

In the current directory you'll find a standard R package named RJSDMX_[version].tar.gz. The package is ready to be installed.


How to install it

Package installation in R is a simple and standard task and it can be done in several ways. For more information, from R type help(INSTALL) or help("install.packages")

Note that in CRAN we'll not upload all the release that we produce. If you want to be at the latest level we suggest to install from github.

  • From github :

The latest package level can also be installed directly from the github repository, by means of the devtools package. Alternatively you can manually download and install the package from one of the releases

require(devtools)
install_github(repo = "amattioc/SDMX", subdir = "RJSDMX")

NOTE:

if the Multiarch (i386, x64) installation does not work on Windows 64bit,
unset the JAVA_HOME environment variable before loading rJava or attempting to install

if (Sys.getenv("JAVA_HOME")!="") Sys.setenv(JAVA_HOME="")

If necessary, override the default configuration by means of a custom configuration file. This is particularly necessary if you want to run the connector in an environment that connects to the internet by means of a proxy.


How to use it

As a preliminary step, the package has to be loaded:

library(RJSDMX)

Help pages can be obtained in the usual way:

help(RJSDMX)

Get the list of available data providers:

getProviders()

Get the list of available data flows for data provider ECB:

getFlows('ECB')

If we want to refine the search with a search pattern:

getFlows('ECB', '*Exchange*')

Get the list of dimensions for data flow EXR:

getDimensions('ECB', 'EXR')

As an alternative, we can explore all the metadata of interest with the graphical SDMX helper:

sdmxHelp()

On OsX, due to a limitation of the R and JAVA integration, the helper has to be created with an external JVM. The command is: sdmxHelp(internalJVM=F)

Finally, let's get some data (I guess this is what you really want...)

single time series, freq=A, CURRENCY=USD
tsList = getTimeSeries('ECB', 'EXR/A.USD.EUR.SP00.A')

multiple time series, FREQUENCY=A (annual), all currencies
tsList = getTimeSeries('ECB', 'EXR/A..EUR.SP00.A')

multiple time series, all currencies, freq = A or M (monthly)
tsList = getTimeSeries('ECB', 'EXR/M+A..EUR.SP00.A')

If you prefer to work with data.frames, you can use the getTimeSeriesTable function:

ddf = getTimeSeriesTable('ECB', 'EXR/M+A..EUR.SP00.A')

The Reference Manual for the latest CRAN version can be found HERE


NOTE about the package configuration:

By default the package uses the configuration file (configuration.properties) that is installed from the source inst/ directory into R library package directory. If you want to change the configuration for all users of the package in this library then you can modify this file. If you want to point to a different configuration file, refer to the main configuration page of this wiki. (Individual users can also specify a configuration file in their home directory).