Learn R Programming

eurostat (version 1.0.16)

get_eurostat: Read data from Eurostat database.

Description

Download dataset from the Eurostat database (ec.europa.eu/eurostat).

Usage

get_eurostat(id, time_format = "date", cache = TRUE, update_cache = FALSE,
  cache_dir = NULL)

Arguments

id

A code name for the data set of interest. See the table of contents of eurostat datasets for details.

time_format

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

cache

a logical wheather to do caching. Default is TRUE.

update_cache

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

cache_dir

a path to cache directory. The NULL uses directory eurostat directory in the temporary directory from tempdir. Directory can be set also with option eurostat_cache_dir.

Value

a data.frame. One column for each dimension in the data and the values column for numerical values. The time column for a time dimension.

Details

Datasets are downloaded from the Eurostat bulk download facility http://ec.europa.eu/eurostat/estat-navtree-portlet-prod/BulkDownloadListing. The data is transformed into the molten row-column-value format (RCV).

By default datasets are cached. In a temporary directory by default or in a named directory if cache_dir or option eurostat_cache_dir is defined.

See Also

{tidy_eurostat}

Examples

Run this code
# NOT RUN {
k <- get_eurostat("namq_aux_lp")
k <- get_eurostat("namq_aux_lp", update_cache = TRUE)
dir.create("r_cache")
k <- get_eurostat("namq_aux_lp", cache_dir = "r_cache")
options(eurostat_update = TRUE)
k <- get_eurostat("namq_aux_lp")
options(eurostat_cache_dir = "r_cache")
k <- get_eurostat("namq_aux_lp")
k <- get_eurostat("namq_aux_lp", cache = FALSE)
# }

Run the code above in your browser using DataLab