Read Statistical Data and Metadata Exchange (SDMX) XML data. This the main transmission format used in official statistics. Data can be imported from local SDMX-ML files or a SDMX web-service and will be read in 'as is' into a dataframe object. The 'RapidXML' C++ library < http://rapidxml.sourceforge.net> is used to parse the XML data.
Read sdmx data into R dataframes from either a local SDMX-ML file or from a SDMX web-service:
u <- "https://stats.oecd.org/restsdmx/sdmx.ashx/GetData/HH_DASH/..Q"d <- readsdmx::read_sdmx(u)
The RapidXML C++ library is used to parse the data.
devtools::install_github("mdequeljoe/readsdmx")
The follow data message types are supported:
For the above example (locally):
download.file(u, path <- tempfile(fileext = ".xml"), quiet = TRUE)microbenchmark::microbenchmark( readsdmx = readsdmx::read_sdmx(path), rsdmx = as.data.frame(rsdmx::readSDMX(path, FALSE)), times = 5L, unit = "s") #> Unit: seconds#> expr min lq mean median uq max neval#> readsdmx 0.158 0.164 0.176 0.166 0.176 0.217 5#> rsdmx 26.321 26.992 30.762 30.757 34.341 35.397 5