Lists names of dataset from Eurostat with the particular pattern in the title, units or short description.

search_eurostat_toc(pattern, lang = "en", verbose = FALSE, ...)

Arguments

pattern

Character string to search for in the table of contents of Eurostat tables/datasets

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)

...

other additional parameters to pass to the grepl function like ignore.case=TRUE if the pattern should be searched case sensitive or not. The default value for ignore.case is FALSE.

Value

A table with the following columns:

titleThe name of dataset/table in the language provided by the lang parameter
codeThe codename of dataset/table which can be used by the get_eurostat function
typeThe type of information: 'dataset' or 'table'
lastUpdateThe date when the data was last time updated for tables and datasets
lastModifiedThe date when the structure of the dataset/table was last time modified
dataStartThe start date of the data in the dataset/table
dataEndThe end date of the data in the dataset/table
valuesThe number of values in the dataset/table
unitThe unit name for tables in the language provided by the lang parameter, if the type 'dataset' this column is empty
shortDescriptionThe short description of the values for tables in the language provided by the lang parameterif the type 'dataset' this column is empty
metadata.htmlThe link to the metadata in html format
metadata.sdmxThe link to the metadata in SDMX format
downloadLink.tsvThe link to the whole dataset/table in tab separated values format in the bulk download facility

The value in the code column can be used as an id in the get_eurostat_data, get_eurostat_bulk, get_eurostat_raw and get_eurostat_dsd functions. If there is no hit for the search query, it returns NULL.

Details

Downloads the list of all tables and datasets available in the Eurostat database and returns all the details from the table of contents of the tables/datasets that contains particular pattern in the dataset title, unit or short description. E.g. all tables/datasets mentioning 'energy'.

Examples

# \dontshow{
if (parallel::detectCores()<=2){
   options(restatapi_cores=1)
}else{
   options(restatapi_cores=2)
}    
# }
# \donttest{
if (!(grepl("amzn|-aws|-azure ",Sys.info()['release']))) options(timeout=2)
head(search_eurostat_toc("energy",verbose=TRUE))
#> 
#> get_eurostat_toc - API version:2 - number of cores:2
#> get_eurostat_toc - Downloading https://ec.europa.eu/eurostat/api/dissemination/catalogue/toc/xml
#> get_eurostat_toc - class(xml_leafs): xml_nodeset
#> get_eurostat_toc - number of nodes: 9148
#> get_eurostat_toc - number of cores: 2
#> get_eurostat_toc - The TOC was cached in memory ('toc.xml.en' in '.restatapi_env').
#>                                                                                                                title
#>                                                                                                               <char>
#> 1:                                                                                Final energy consumption by sector
#> 2:                                                                                         Primary energy production
#> 3:                                                                      Secondary energy production (transformation)
#> 4: Psychological well-being (energy and vitality index) by sex, age and educational attainment level (average score)
#> 5:             Multi-yearly enterprise statistics - purchases of energy products (NACE Rev. 1.1, C, D, F, 1997-2001)
#> 6:     Multi-yearly enterprise statistics - purchases of energy products (NACE Rev. 1.1, C, D, F, from 1999 onwards)
#>               code    type lastUpdate lastModified dataStart dataEnd values
#>             <char>  <char>     <char>       <char>    <char>  <char>  <num>
#> 1: enps_nrg_bal_c1 dataset 2024.02.26   2024.02.26      2005    2022    329
#> 2:        med_eg10 dataset 2020.05.28   2020.05.28      2005    2018    391
#> 3:        med_eg20 dataset 2016.10.28   2024.01.10      2000    2015    776
#> 4:   hlth_ehis_st8 dataset 2014.03.20   2023.12.21      2008    2008   1455
#> 5:    sbs_pu_2l_97 dataset 2009.03.27   2021.02.08      1997    2001  77962
#> 6:    sbs_pu_4l_02 dataset 2012.08.20   2021.02.08      1999    2007  61689
#>      unit shortDescription
#>    <char>           <char>
#> 1:                        
#> 2:                        
#> 3:                        
#> 4:                        
#> 5:                        
#> 6:                        
#>                                                        metadata.html
#>                                                               <char>
#> 1:     https://ec.europa.eu/eurostat/cache/metadata/en/enps_esms.htm
#> 2:      https://ec.europa.eu/eurostat/cache/metadata/en/med_esms.htm
#> 3:      https://ec.europa.eu/eurostat/cache/metadata/en/med_esms.htm
#> 4: https://ec.europa.eu/eurostat/cache/metadata/en/hlth_det_esms.htm
#> 5:   https://ec.europa.eu/eurostat/cache/metadata/en/sbs_pu_esms.htm
#> 6:   https://ec.europa.eu/eurostat/cache/metadata/en/sbs_pu_esms.htm
#>                                                                                 metadata.sdmx
#>                                                                                        <char>
#> 1:     https://ec.europa.eu/eurostat/api/dissemination/files?file=metadata/enps_esms.sdmx.zip
#> 2:      https://ec.europa.eu/eurostat/api/dissemination/files?file=metadata/med_esms.sdmx.zip
#> 3:      https://ec.europa.eu/eurostat/api/dissemination/files?file=metadata/med_esms.sdmx.zip
#> 4: https://ec.europa.eu/eurostat/api/dissemination/files?file=metadata/hlth_det_esms.sdmx.zip
#> 5:   https://ec.europa.eu/eurostat/api/dissemination/files?file=metadata/sbs_pu_esms.sdmx.zip
#> 6:   https://ec.europa.eu/eurostat/api/dissemination/files?file=metadata/sbs_pu_esms.sdmx.zip
#>                                                                                            downloadLink.tsv
#>                                                                                                      <char>
#> 1: https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/ENPS_NRG_BAL_C1?format=tsv&compressed=true
#> 2:        https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/MED_EG10?format=tsv&compressed=true
#> 3:        https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/MED_EG20?format=tsv&compressed=true
#> 4:   https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/HLTH_EHIS_ST8?format=tsv&compressed=true
#> 5:    https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/SBS_PU_2L_97?format=tsv&compressed=true
#> 6:    https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/SBS_PU_4L_02?format=tsv&compressed=true
nrow(search_eurostat_toc("energy"))
#> [1] 97
head(search_eurostat_toc("energie",lang="de",ignore.case=TRUE))
#>                                                                    title
#>                                                                   <char>
#> 1:                                            Energie - monatliche Daten
#> 2:                                                         Energiebilanz
#> 3:                                       Endenergieverbrauch nach Sektor
#> 4: Energie - historische daten (2004-2007, ehemalige Methode und Quelle)
#> 5:                                               Primäre Energierzeugung
#> 6:                                 Sekundäre Energierzeugung (Umsetzung)
#>               code    type lastUpdate lastModified dataStart dataEnd values
#>             <char>  <char>     <char>       <char>    <char>  <char>  <num>
#> 1:       ei_isen_m   table 2024.03.25   2024.03.25   2008-01 2024-02  76807
#> 2:  enps_nrg_bal_c dataset 2024.02.26   2024.02.26      2005    2022    693
#> 3: enps_nrg_bal_c1 dataset 2024.02.26   2024.02.26      2005    2022    329
#> 4:      med_eg_all dataset 2014.12.08   2023.12.21      1990    2011    935
#> 5:        med_eg10 dataset 2020.05.28   2020.05.28      2005    2018    391
#> 6:        med_eg20 dataset 2016.10.28   2024.01.10      2000    2015    776
#>      unit shortDescription
#>    <char>           <char>
#> 1:                        
#> 2:                        
#> 3:                        
#> 4:                        
#> 5:                        
#> 6:                        
#>                                                     metadata.html
#>                                                            <char>
#> 1: https://ec.europa.eu/eurostat/cache/metadata/en/ei_is_esms.htm
#> 2:  https://ec.europa.eu/eurostat/cache/metadata/en/enps_esms.htm
#> 3:  https://ec.europa.eu/eurostat/cache/metadata/en/enps_esms.htm
#> 4:   https://ec.europa.eu/eurostat/cache/metadata/en/med_esms.htm
#> 5:   https://ec.europa.eu/eurostat/cache/metadata/en/med_esms.htm
#> 6:   https://ec.europa.eu/eurostat/cache/metadata/en/med_esms.htm
#>                                                                              metadata.sdmx
#>                                                                                     <char>
#> 1: https://ec.europa.eu/eurostat/api/dissemination/files?file=metadata/ei_is_esms.sdmx.zip
#> 2:  https://ec.europa.eu/eurostat/api/dissemination/files?file=metadata/enps_esms.sdmx.zip
#> 3:  https://ec.europa.eu/eurostat/api/dissemination/files?file=metadata/enps_esms.sdmx.zip
#> 4:   https://ec.europa.eu/eurostat/api/dissemination/files?file=metadata/med_esms.sdmx.zip
#> 5:   https://ec.europa.eu/eurostat/api/dissemination/files?file=metadata/med_esms.sdmx.zip
#> 6:   https://ec.europa.eu/eurostat/api/dissemination/files?file=metadata/med_esms.sdmx.zip
#>                                                                                            downloadLink.tsv
#>                                                                                                      <char>
#> 1:       https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/EI_ISEN_M?format=tsv&compressed=true
#> 2:  https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/ENPS_NRG_BAL_C?format=tsv&compressed=true
#> 3: https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/ENPS_NRG_BAL_C1?format=tsv&compressed=true
#> 4:      https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/MED_EG_ALL?format=tsv&compressed=true
#> 5:        https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/MED_EG10?format=tsv&compressed=true
#> 6:        https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/MED_EG20?format=tsv&compressed=true
nrow(search_eurostat_toc("energie",lang="de",ignore.case=TRUE))
#> [1] 111
options(timeout=60)
# }