Eurostat Bulk SDMX data download into R? -


i'm having troubles trying download bulk data eurostat, hope can me out. based code post.

library(devtools) require(devtools) install_github("rsdmx", "opensdmx") require(rsdmx)  # make temporary file (tf) , temporary folder (tdir) tf <- tempfile(tmpdir = tdir <- tempdir())  ## download zip file  download.file("http://ec.europa.eu/eurostat/estat-navtree-portlet-prod/bulkdownloadlisting?sort=1&file=data%2frd_e_gerdsc.sdmx.zip", tf)  ## unzip in temp folder test <- unzip(tf, exdir = tdir)  sdmx <- readsdmx(test)  stats <- as.data.frame(sdmx) head(stats) 

i'm receiving warning, , dataframe empty:

warning message: in if (attr(regexpr("<!doctype html>", content), "match.length") ==  :   condition has length > 1 , first element used 

in eurostat, result of extraction made of 2 separate xml files:

  • the dsd (data structure definition), describes sdmx dataset
  • the dataset itself

based on code, try this:

testfile <- test[2] #path dataset sdmx <- readsdmx(testfile, isurl = false) # isurl = false (to read local file) stats <- as.data.frame(sdmx) head(stats) 

note: calling as.data.frame might take time complete, depending on size of dataset. have been performing more tests in order further improve performance of reading large sdmx datasets.

your use case interesting, add rsdmx documentation shows how use both eurostat bulk download service , rsdmx.

hope helps!


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -