extract_data: Extract data values from SDMX XML

Description Usage Arguments Details Value Examples

View source: R/extract_data.R

Description

Extracts the data values from the SDMX XML data file

Usage

1
2
extract_data(xml_lf, keep_flags = FALSE,
  stringsAsFactors = default.stringsAsFactors())

Arguments

xml_lf

an XML leaf with data series from an SDMX XML file

keep_flags

a boolean if to extract the observation status (flag) information from the XML file. The default value is FALSE

stringsAsFactors

if TRUE (the default) the columns are converted to factors. If FALSE they are returned as a character.

Details

It is a subfunction to use in the get_eurostat_data function.

Value

a data frame with

Examples

1
2
3
4
5
6
7
8
id<-"agr_r_milkpr"
toc<-get_eurostat_toc()
bulk_url<-toc$downloadLink.sdmx[toc$code==id]
temp<-tempfile()
download.file(bulk_url,temp)
sdmx_xml<-xml2::read_xml(unzip(temp, paste0(id,".sdmx.xml")))
xml_leafs<-xml2::xml_find_all(sdmx_xml,".//data:Series")
extract_data(xml_leafs[1])

restatapi documentation built on July 24, 2019, 1:05 a.m.