get_eurostat_toc {restatapi}R Documentation

Download the Table of Contents of Eurostat datasets

Description

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

Usage

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

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 different formats (SDMX, TSV))

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. From the downloaded TOC the values in the 'code' column can be used as id in the get_eurostat_dsd, get_eurostat_raw, get_eurostat_bulk, and get_eurostat_data functions.

Value

A data 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 as id in other functions
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, and 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 and this 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 and this column exists only if the download mode is "xml"
metadata.html The link to the metadata in html format, and this column exists only if the download mode is "xml"
metadata.sdmx The link to the metadata in SDMX format, and this 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 and this column exists only if the download mode is "xml"

References

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

See Also

search_eurostat_toc, get_eurostat_dsd, get_eurostat_raw, get_eurostat_bulk, get_eurostat_data.

Examples



if (!(grepl("amzn|-aws|-azure ",Sys.info()['release']))) options(timeout=2)
toc_xml<-get_eurostat_toc(cache=FALSE,verbose=TRUE)
head(toc_xml)
toc_txt<-get_eurostat_toc(mode="txt", lang="de")
head(toc_txt)
options(timeout=60)


[Package restatapi version 0.23.1 Index]