Build Status

`rsdmx: Tools for reading SDMX data and metadata documents in R


rsdmx is a package to parse/read SDMX data and metadata in R. It provides a set of classes and methods to read data and metadata documents exchanged through the Statistical Data and Metadata Exchange (SDMX) framework. The package currently focuses on the SDMX XML standard format (SDMX-ML). Learn more.

Citation: We thank in advance people that use rsdmx for citing it in their work / publication(s). For this, please use the citation provided at this link DOI

Fundings rsdmx is looking for sponsors !! Please help us to make the package growing!

Status At now, the package allows to read: * Datasets (GenericData, CompactData, StructureSpecificData, UtilityData and MessageGroup SDMX-ML types) * Concepts (Concept, ConceptScheme and Concepts SDMX-ML types) * Codelists (Code, Codelist and Codelists SDMX-ML types) * DataStructures / KeyFamilies - with all subtypes * Data Structure Definitions (DSDs) - with all subtypes

It has been tested on all SDMX standard format versions 1.0, 2.0 and 2.1

R CRAN rsdmx check results:

Please note that following a new submission to CRAN, or eventually a modification of CRAN policies, the package might be temporarily archived, and removed from CRAN. In case you notice that the package is not back in few time, please contact me.

Mailing list:!forum/rsdmx
You can subscribe directly in the google group, or by email: To send a post, use: To unsubscribe, send an email to:


rsdmx offers a low-level set of tools to read data and metadata in SDMX format. Its strategy is to make it very easy for the user. For this, a unique function named readSDMX has to be used, whatever it is a data or metadata document, or if it is local or remote datasource.

Install rsdmx

rsdmx can be installed from CRAN {r, echo = FALSE} install.packages("rsdmx")

or from its development repository hosted in Github (using the devtools package):

{r, echo = FALSE} devtools::install_github("opensdmx/rsdmx")

Load rsdmx

To load rsdmx in R, do the following:

{r, echo = FALSE} library(rsdmx)

Read dataset documents

This section will introduce you on how to read SDMX dataset documents, either from remote datasources, or from local SDMX files.

Read remote datasets

The following code snipet shows you how to read a dataset from a remote data source, taking as example the FAO data portal:

{r, echo = FALSE} myUrl <- "" dataset <- readSDMX(myUrl) stats <-

You can try it out with other datasources, such as: * OECD StatExtracts portal: * EUROSTAT portal: * European Central Bank (ECB):

The online rsdmx documentation also provides a list of data providers, either from international or national institutions.

Read local datasets

This example shows you how to use rsdmx with local SDMX files, previously downloaded from EUROSTAT.

```{r, echo = FALSE} #bulk download from Eurostat tf <- tempfile(tmpdir = tdir <- tempdir()) #temp file and folder download.file("", tf) sdmx_files <- unzip(tf, exdir = tdir)

sdmx <- readSDMX(sdmx_files[2], isURL = FALSE) stats <- head(stats)


By default, readSDMX considers the data source is remote. To read a local file, add isURL = FALSE.

Read metadata documents

This section will introduce you on how to read SDMX metadata documents, including concepts, codelists and complete data structure definitions (DSD)


Read concept schemes from FAO data portal

{r, echo = FALSE} csUrl <- "" csobj <- readSDMX(csUrl) csdf <- head(csdf)


Read codelists from FAO data portal {r, echo = FALSE} clUrl <- "" clobj <- readSDMX(clUrl) cldf <- head(cldf)

Data Structure Definition (DSD)

This example illustrates how to read a complete DSD using a OECD StatExtracts portal data source.

{r, echo = FALSE} dsdUrl <- "" dsd <- readSDMX(dsdUrl)

rsdmx is implemented in object-oriented way with S4 classes and methods. The properties of S4 objects are named slots and can be accessed with the slot method. The following code snippet allows to extract the list of codelists contained in the DSD document, and read one codelist as data.frame.

{r, echo = FALSE} #get codelists from DSD cls <- slot(dsd, "codelists") codelists <- sapply(slot(cls, "codelists"), function(x) slot(x, "id")) #get list of codelists codelist <-, "codelists"), codelistId = "CL_TABLE1_FLOWS") #get a codelist

In a similar way, the concepts of the dataset can be extracted from the DSD and read as data.frame.

{r, echo = FALSE} #get concepts from DSD concepts <-, "concepts"))