get_eurostat_toc: Download the Table of Contents of Eurostat datasets

Description Usage Arguments Details Value References See Also Examples

View source: R/get_eurostat_toc.R

Description

Download Table of Contents (TOC) of Eurostat datasets if it is not cached previously.

Usage

1
2
3
get_eurostat_toc(mode = "xml", cache = TRUE, update_cache = FALSE,
  cache_dir = NULL, compress_file = TRUE, lang = "en", verbose = F,
  ...)

Arguments

mode

a character string either xml or txt defining the download mode. Depending on the mode the 'xml' version or the 'text' version of the TOC is downloaded. The deafult value is xml as it provides more information (e.g. number of values, short description and download links in diffrent format)

cache

a boolean whether to load/save the TOC from/in the cache or not. The default value is TRUE, so that the TOC is checked first in the cache and if does not exist then downloaded from Eurostat and cached.

update_cache

a boolean to update cache or not. The default value is FALSE, so the cache is not updated. Can be set also with options(restatapi_update=TRUE)

cache_dir

a path to a cache directory. The default is NULL, in this case the TOC is cached in the memory (in the '.restatapi_env'). Otherwise if the cache_dir directory does not exist it creates the 'restatapi' directory in the temporary directory from tempdir() to save the RDS- file. Directory can also be set with option(restatapi_cache_dir=...).

compress_file

a logical whether to compress the RDS-file in caching. Default is TRUE.

lang

a character string either en, de or fr to define the language version for the table of contents. The default is en - English.

verbose

A boolean with default FALSE, so detailed messages (for debugging) will not printed. Can be set also with options(restatapi_verbose=TRUE)

...

parameter to pass on the load_cfg function

Details

The TOC is downloaded from Eurostat websites through the REST API for the xml (default) version or from the bulk download facilities for txt version.

Value

A table with the following columns:

title The name of dataset/table in the language provided by the lang parameter
code The codename of dataset/table which can be used by the get_eurostat function
type The type of information: 'dataset' or 'table'
lastUpdate The date when the data was last time updated for tables and datasets
lastModified The date when the structure of the dataset/table was last time modified
dataStart The start date of the data in the dataset/table
dataEnd The end date of the data in the dataset/table
values The number of values in the dataset/table. It is filled only if the download mode is "xml"
unit The unit name for tables in the language provided by the lang parameter. For dataset it is empty. The column exists only if the download mode is "xml"
shortDescription The short description of the values for tables in the language provided by the lang parameter. For dataset it is empty. The column exists only if the download mode is "xml"
metadata.html The link to the metadata in html format. The column exists only if the download mode is "xml"
metadata.sdmx The link to the metadata in SDMX format. The column exists only if the download mode is "xml"
downloadLink.tsv The link to the whole dataset/table in tab separated values format in the bulk download facility. The column exists only if the download mode is "xml"
downloadLink.sdmx The link to the whole dataset/table in SDMX format in the bulk download facility. The column exists only if the download mode is "xml"

References

For more technical information see the detailed documentation of the API.

See Also

get_eurostat_data, search_eurostat_toc.

Examples

1
2
3
4
toc_xml<-get_eurostat_toc(cache=FALSE,verbose=TRUE)
head(toc_xml)
toc_txt<-get_eurostat_toc(mode="txt", lang="de")
head(toc_txt)

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