Jakob
Jakob

Reputation: 1453

R: "SmarterPoland" outdated?

I used this package before and it worked perfectly. Eurostat changed their data website a little (though I don't think they changed the SDMX codes etc) and SmarterPoland yields an error message as if the first entry in the dataframe is missing or something along those lines:

install.packages("SmarterPoland")
library(SmarterPoland)
tmp <- getEurostatRCV(kod = "educ_iste") #this is the example from ?SmarterPoland

Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 1 did not have 5 elements

I tried this with a variety of codes, all yield the same error message.

Any help would be appreciated.

p.s.: This might help those who understand these backend codes... ;-) http://ec.europa.eu/eurostat/help/new-eurostat-website

Upvotes: 0

Views: 112

Answers (2)

Miha Trošt
Miha Trošt

Reputation: 2022

The package maintainer has already changed the root of the url that changed when new design of the Eurostat website was introduced. Hence, the functions in the package should work. Just update the package.

Upvotes: 1

eblondel
eblondel

Reputation: 603

Looking at the SmarterPoland, the maintainer fixed the issue of EUROSTAT url (see here), try to update your package, or install it directly from Github (in case the fix would not be available in CRAN).

Alternatively, you may consider to use rsdmx. The package is generic (not datasource specific) and low-level so you can read SDMX data & metadata documents, whatever they are remote or local.

An example with EUROSTAT:

dataURL <- "http://ec.europa.eu/eurostat/SDMX/diss-web/rest/data/cdh_e_fos/..PC.FOS1.BE/?startperiod=2005&endPeriod=2011 "
sdmx <- readSDMX(dataURL)
stats <- as.data.frame(sdmx)
head(stats)

There are more examples here: https://github.com/opensdmx/rsdmx/wiki#examples

Note that as it is low-level, you have to provide the url yourself. It might seen as less convenient, but has the advantage to be flexible. We plan to add more functions on top of readSDMX to facilitate querying of particular data sources (like EUROSTAT).

Upvotes: 1

Related Questions