Download data sets from Eurostat

  time_format = "date",
  filters = "none",
  type = "code",
  select_time = NULL,
  cache = TRUE,
  update_cache = FALSE,
  cache_dir = NULL,
  compress_file = TRUE,
  stringsAsFactors = FALSE,
  keepFlags = FALSE,



A code name for the dataset of interest. See search_eurostat() or details for how to get code.


a string giving a type of the conversion of the time column from the eurostat format. A "date" (default) converts to a Date() with a first date of the period. A "date_last" converts to a Date() with a last date of the period. A "num" converts to a numeric and "raw" does not do conversion. See eurotime2date() and eurotime2num().


a "none" (default) to get a whole dataset or a named list of filters to get just part of the table. Names of list objects are Eurostat variable codes and values are vectors of observation codes. If NULL the whole dataset is returned via API. More on details. See more on filters and limitations per query via API from for get_eurostat_json().


A type of variables, "code" (default) or "label".


a character symbol for a time frequency or NULL, which is used by default as most datasets have just one time frequency. For datasets with multiple time frequencies, select the desired time format with: Y = annual, S = semi-annual, Q = quarterly, M = monthly. For all frequencies in same data frame time_format = "raw" should be used.


a logical whether to do caching. Default is TRUE. Affects only queries from the bulk download facility.


a logical whether to update cache. Can be set also with options(eurostat_update = TRUE)


a path to a cache directory. The directory must exist. The NULL (default) uses and creates 'eurostat' directory in the temporary directory from tempdir(). The directory can also be set with set_eurostat_cache_dir().


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


if TRUE (the default) variables are converted to factors in original Eurostat order. If FALSE they are returned as a character.


a logical whether the flags (e.g. "confidential", "provisional") should be kept in a separate column or if they can be removed. Default is FALSE. For flag values see: Also possible non-real zero "0n" is indicated in flags column. Flags are not available for eurostat API, so keepFlags can not be used with a filters.


Arguments passed on to get_eurostat_json


A language used for metadata (en/fr/de).


a tibble. One column for each dimension in the data, the time column for a time dimension and the values column for numerical values. Eurostat data does not include all missing values and a treatment of missing values depend on source. In bulk download facility missing values are dropped if all dimensions are missing on particular time. In JSON API missing values are dropped only if all dimensions are missing on all times. The data from bulk download facility can be completed for example with tidyr::complete().


Data sets are downloaded from the Eurostat bulk download facility or from The Eurostat Web Services JSON API. If only the table id is given, the whole table is downloaded from the bulk download facility. If also filters are defined the JSON API is used.

The bulk download facility is the fastest method to download whole datasets. It is also often the only way as the JSON API has limitation of maximum 50 sub-indicators at time and whole datasets usually exceeds that. Also, it seems that multi frequency datasets can only be retrieved via bulk download facility and the select_time is not available for JSON API method.

If your connection is thru a proxy, you probably have to set proxy parameters to use JSON API, see get_eurostat_json().

By default datasets from the bulk download facility are cached as they are often rather large. Caching is not (currently) possible for datasets from JSON API. Cache files are stored in a temporary directory by default or in a named directory (See set_eurostat_cache_dir()). The cache can be emptied with clean_eurostat_cache().

The id, a code, for the dataset can be searched with the search_eurostat() or from the Eurostat database The Eurostat database gives codes in the Data Navigation Tree after every dataset in parenthesis.


See citation("eurostat"):

# Kindly cite the eurostat R package as follows:
#   (C) Leo Lahti, Janne Huovari, Markus Kainu, Przemyslaw Biecek.
#   Retrieval and analysis of Eurostat open data with the eurostat
#   package. R Journal 9(1):385-392, 2017. Version 3.7.9 doi:
#   10.32614/RJ-2017-019 Package URL:
#   Article URL:
# A BibTeX entry for LaTeX users is
#   @Article{,
#     title = {Retrieval and Analysis of Eurostat Open Data with the
#            eurostat Package},
#     author = {Leo Lahti and Janne Huovari and Markus Kainu and Przemyslaw Biecek},
#     journal = {The R Journal},
#     volume = {9},
#     number = {1},
#     pages = {385--392},
#     year = {2017},
#     doi = {10.32614/RJ-2017-019},
#     url = {},
#     note = {Version 3.7.9},
#   }


Przemyslaw Biecek, Leo Lahti, Janne Huovari and Markus Kainu


# \donttest{
k <- get_eurostat("nama_10_lp_ulc")
#> Reading cache file /tmp/RtmpNcFzcA/eurostat/nama_10_lp_ulc_date_code_FF.rds
#> Table  nama_10_lp_ulc  read from cache file:  /tmp/RtmpNcFzcA/eurostat/nama_10_lp_ulc_date_code_FF.rds
k <- get_eurostat("nama_10_lp_ulc", time_format = "num")
#> Table nama_10_lp_ulc cached at /tmp/RtmpNcFzcA/eurostat/nama_10_lp_ulc_num_code_FF.rds
k <- get_eurostat("nama_10_lp_ulc", update_cache = TRUE)
#> Table nama_10_lp_ulc cached at /tmp/RtmpNcFzcA/eurostat/nama_10_lp_ulc_date_code_FF.rds

k <- get_eurostat("nama_10_lp_ulc",
  cache_dir = file.path(tempdir(), "r_cache")
#> Table nama_10_lp_ulc cached at /tmp/RtmpNcFzcA/r_cache/nama_10_lp_ulc_date_code_FF.rds
options(eurostat_update = TRUE)
k <- get_eurostat("nama_10_lp_ulc")
#> Table nama_10_lp_ulc cached at /tmp/RtmpNcFzcA/eurostat/nama_10_lp_ulc_date_code_FF.rds
options(eurostat_update = FALSE)

set_eurostat_cache_dir(file.path(tempdir(), "r_cache2"))
#> eurostat cache dir is: /tmp/RtmpNcFzcA/r_cache2
#> To install your cache_dir path for use in future sessions,
#> run this function with `install = TRUE`.
k <- get_eurostat("nama_10_lp_ulc")
#> Table nama_10_lp_ulc cached at /tmp/RtmpNcFzcA/r_cache2/nama_10_lp_ulc_date_code_FF.rds
k <- get_eurostat("nama_10_lp_ulc", cache = FALSE)
k <- get_eurostat("avia_gonc", select_time = "Y", cache = FALSE)
# }
if (FALSE) {
dd <- get_eurostat("nama_10_gdp",
  filters = list(
    geo = "FI",
    na_item = "B1GQ",
    unit = "CLV_I10"