Information retrieval from Destatis Genesis webservices

genesisAPI(api.param = stop("'api.param' must be specified"),
  service = stop("'service' must be specified"), curl = NULL,
  query = FALSE)

metaClean(s)

genesisXMLtoDF(xml.list = stop("'xml.list' must be provided"), meta = FALSE)

genesisDFtoXTS(data = stop("'data' must be provided"))

genesisTables(namefilter = c(11:14, 2, 3, 41:49, 5:9), fields = c("code",
  "beschriftungstext"), kennung = stop("'kennung' must be provided"),
  passwort = stop("'passwort' must be provided"), curl = NULL)

Arguments

api.param

a list with parameters used to construct the query, see example

service

the webservice to use, e.g. ExportService or RechercheService

curl

optional, CURL handle created with RCurl::getCurlHandle()

query

logical, return the https query

s

metadata string to convert to data frame

xml.list

a character string returned from

data

a data frame created with genesisXMLtoDF

namefilter

numeric vector to filter dataset codes.

fields

character vector to select fields from entries.

kennung

user ID.

passwort

user password.

curl

handle created with `RCurl::getCurlHandle`.

Value

The main function creates an URL with with the specified parameters, retrieves the XML string and transforms into an R list. Additional functions convert the returned list to data frame and xts objects.

Details

Retrieve information from Destatis Genesis quader in linearised XML format. The retrieval function requires a premium login https://www-genesis.destatis.de/genesis/online

Examples

# NOT RUN {
api.param.datenexport <- list(
    method = "DatenExport",
    kennung = "KENNUNG",
    passwort = "PASSWORT",
    namen = "81000BJ002",
    bereich = "oeffentlich",
    format = "csv",
    werte = "true",
    metadaten = "false",
    zusatz = "false",
    startjahr = "",
    endjahr = "",
    zeitscheiben = "",
    regionalschluessel = "",
    sachmerkmal = "",
    sachschluessel = "",
    stand = "01.01.2001",
    sprache = "de"
)

curl <- RCurl::getCurlHandle()
## RCurl::curlSetOpt(.opts = list(proxy = ""), curl = curl)

xml.list.datenexport <- genesisAPI(api.param = api.param.datenexport,
                                   service = "ExportService",
                                   curl = curl)

## convert to data frame
data.df <- genesisXMLtoDF(xml.list = xml.list.datenexport)

## convert to xts object, e.g. for use in \code{dygraphs} package
data.xts <- genesisDFtoXTS(data = data.df)

## extract metadata
api.param.datenexport.meta <-
 api.param.datenexport

api.param.datenexport.meta[["werte"]] <- "false"
api.param.datenexport.meta[["zusatz"]] <- "true"

xml.list.datenexport.meta <- genesisAPI(api.param = api.param.datenexport.meta,
                                        service = "ExportService",
                                        curl = ui.apiGENESIS.curl
                                        )

meta.df <- genesisXMLtoDF(xml.list = xml.list.datenexport.meta,
                          meta = TRUE)
# }