# SDMX datasets
#--------------
if (FALSE) {
# Not run
# (local dataset examples)
#with SDMX 2.0
tmp <- system.file("extdata","Example_Eurostat_2.0.xml", package="rsdmx")
sdmx <- readSDMX(tmp, isURL = FALSE)
stats <- as.data.frame(sdmx)
head(stats)
#with SDMX 2.1
tmpnew <- system.file("extdata","Example_Eurostat_2.1.xml", package="rsdmx")
sdmx <- readSDMX(tmpnew, isURL = FALSE)
stats <- as.data.frame(sdmx)
head(stats)
## End(**Not run**)
}
if (FALSE) {
# Not run by 'R CMD check'
# (reliable remote datasource but with possible occasional unavailability)
#examples using embedded providers
sdmx <- readSDMX(providerId = "OECD", resource = "data", flowRef = "MIG",
key = list("TOT", NULL, NULL), start = 2011, end = 2011)
stats <- as.data.frame(sdmx)
head(stats)
#examples using 'file' argument
#using url (Eurostat REST SDMX 2.1)
url <- paste("http://ec.europa.eu/eurostat/SDMX/diss-web/rest/data/",
"cdh_e_fos/all/?startperiod=2000&endPeriod=2010",
sep = "")
sdmx <- readSDMX(url)
stats <- as.data.frame(sdmx)
head(stats)
## End(**Not run**)
}
# SDMX DataStructureDefinition (DSD)
#-----------------------------------
if (FALSE) {
# Not run by 'R CMD check'
# (reliable remote datasource but with possible occasional unavailability)
#using embedded providers
dsd <- readSDMX(providerId = "OECD", resource = "datastructure",
resourceId = "WATER_ABSTRACT")
#get codelists from DSD
cls <- slot(dsd, "codelists")
codelists <- sapply(slot(cls,"codelists"), slot, "id") #get list of codelists
#get a codelist
codelist <- as.data.frame(cls, codelistId = "CL_WATER_ABSTRACT_SOURCE")
#get concepts from DSD
concepts <- as.data.frame(slot(dsd, "concepts"))
## End(**Not run**)
}
Run the code above in your browser using DataLab