R/search_eurostat_toc.R
search_eurostat_toc.RdLists names of dataset from Eurostat with the particular pattern in the title, units or short description.
search_eurostat_toc(pattern, lang = "en", verbose = FALSE, ...)Character string to search for in the table of contents of Eurostat tables/datasets
a character string either en, de or fr to define the language version for the table of contents. The default is en - English.
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.
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 |
unit | The unit name for tables in the language provided by the lang parameter, if the type 'dataset' this column is empty |
shortDescription | The short description of the values for tables in the language provided by the lang parameterif the type 'dataset' this column is empty |
metadata.html | The link to the metadata in html format |
metadata.sdmx | The link to the metadata in SDMX format |
downloadLink.tsv | The 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.
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'.
# \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: 10458
#> 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 production by energy source - ENP-South countries
#> 3: Net imports of energy products - ENP-South countries
#> 4: Gross inland consumption of energy - ENP-Sounth countries
#> 5: Share of renewable energy in gross final energy consumption - ENP-South countries
#> 6: Primary production by source of energy, ENP-East countries
#> code type lastUpdate lastModified dataStart dataEnd values
#> <char> <char> <char> <char> <char> <char> <num>
#> 1: enps_nrg_bal_c1 dataset 2025.05.12 2025.05.12 2005 2023 371
#> 2: enps_nrg_pprd dataset 2025.05.12 2025.05.12 2005 2023 311
#> 3: enps_nrg_imp dataset 2025.05.12 2025.05.12 2005 2023 147
#> 4: enps_nrg_gic dataset 2025.05.12 2025.05.12 2005 2023 119
#> 5: enps_nrg_rnew dataset 2025.05.12 2025.05.12 2006 2023 37
#> 6: enpe_nrg_pprd dataset 2026.02.03 2026.02.03 2005 2024 265
#> unit source shortDescription
#> <char> <char> <char>
#> 1: Eurostat
#> 2: Eurostat
#> 3: Eurostat
#> 4: Eurostat
#> 5: Eurostat
#> 6: Eurostat
#> metadata.html
#> <char>
#> 1: https://ec.europa.eu/eurostat/cache/metadata/en/enps_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/enps_esms.htm
#> 5: https://ec.europa.eu/eurostat/cache/metadata/en/enps_esms.htm
#> 6: https://ec.europa.eu/eurostat/cache/metadata/en/enpe_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/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/enps_esms.sdmx.zip
#> 5: https://ec.europa.eu/eurostat/api/dissemination/files?file=metadata/enps_esms.sdmx.zip
#> 6: https://ec.europa.eu/eurostat/api/dissemination/files?file=metadata/enpe_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/ENPS_NRG_PPRD?format=tsv&compressed=true
#> 3: https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/ENPS_NRG_IMP?format=tsv&compressed=true
#> 4: https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/ENPS_NRG_GIC?format=tsv&compressed=true
#> 5: https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/ENPS_NRG_RNEW?format=tsv&compressed=true
#> 6: https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/ENPE_NRG_PPRD?format=tsv&compressed=true
nrow(search_eurostat_toc("energy"))
#> [1] 121
head(search_eurostat_toc("energie",lang="de",ignore.case=TRUE))
#> title code
#> <char> <char>
#> 1: Energie - monatliche Daten ei_isen_m
#> 2: Energiebilanz - südliche ENP-Länder enps_nrg_bal_c
#> 3: Endenergieverbrauch nach Sektor enps_nrg_bal_c1
#> 4: Primärproduktion nach Energiequelle - südliche ENP-Länder enps_nrg_pprd
#> 5: Nettoimporte von Energieprodukten - südliche ENP-Länder enps_nrg_imp
#> 6: Bruttoinlandsenergieverbrauch - südliche ENP-Länder enps_nrg_gic
#> type lastUpdate lastModified dataStart dataEnd values unit source
#> <char> <char> <char> <char> <char> <num> <char> <char>
#> 1: table 2026.02.03 2026.01.21 2008-01 2025-12 92850 Eurostat
#> 2: dataset 2025.05.12 2025.05.12 2005 2023 766 Eurostat
#> 3: dataset 2025.05.12 2025.05.12 2005 2023 371 Eurostat
#> 4: dataset 2025.05.12 2025.05.12 2005 2023 311 Eurostat
#> 5: dataset 2025.05.12 2025.05.12 2005 2023 147 Eurostat
#> 6: dataset 2025.05.12 2025.05.12 2005 2023 119 Eurostat
#> shortDescription
#> <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/enps_esms.htm
#> 5: https://ec.europa.eu/eurostat/cache/metadata/en/enps_esms.htm
#> 6: https://ec.europa.eu/eurostat/cache/metadata/en/enps_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/enps_esms.sdmx.zip
#> 5: https://ec.europa.eu/eurostat/api/dissemination/files?file=metadata/enps_esms.sdmx.zip
#> 6: https://ec.europa.eu/eurostat/api/dissemination/files?file=metadata/enps_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/ENPS_NRG_PPRD?format=tsv&compressed=true
#> 5: https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/ENPS_NRG_IMP?format=tsv&compressed=true
#> 6: https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/ENPS_NRG_GIC?format=tsv&compressed=true
nrow(search_eurostat_toc("energie",lang="de",ignore.case=TRUE))
#> [1] 132
options(timeout=60)
# }