Downloads and extracts the data values from the SDMX XML data file
get_compressed_sdmx(url = NULL, verbose = FALSE, format = "gz")
a URL from the bulk download facility to download the zipped SDMX XML file
a logical value with default FALSE
, so detailed messages (for debugging) will not printed.
Can be set also with options(restatapi_verbose=TRUE)
.
the format of the compression, either "zip" or "gz" the default value
an xml class object with SDMX tags extracted and read from the downloaded file.
It is a sub-function to use in the get_eurostat_raw
and the get_eurostat_data
functions.
id<-"agr_r_milkpr"
url<-paste0("https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/",
id,
"?format=sdmx_2.1_structured&compressed=true")
if (!(grepl("amzn|-aws|-azure ",Sys.info()['release']))) options(timeout=2)
sdmx_xml<-get_compressed_sdmx(url,verbose=TRUE,format="gz")
#>
#> get_compressed_sdmx - url:https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/agr_r_milkpr?format=sdmx_2.1_structured&compressed=true
#> get_compressed_sdmx - format:gz
#> get_compressed_sdmx - xml NULL:FALSE
options(timeout=60)