create_filter_table {restatapi} | R Documentation |
Create a filter table
Description
Create filter table from the filters
and date_filter
strings parameters of the get_eurostat_data
to be used in the filter_raw_data
function for filtering by query or on the local computer.
Usage
create_filter_table(
filters,
date_filter = FALSE,
dsd = NULL,
exact_match = TRUE,
verbose = FALSE,
...
)
Arguments
filters |
a string, a character or numeric vector or a named list containing words to filter by the different concepts, geographical location or time values.
The words can be any word, Eurostat variable code, or value which are in the Data Structure Definition (DSD) and can be retrieved by the |
date_filter |
a logical value. If |
dsd |
a table containing a DSD of an Eurostat dataset which can be retreived by the |
exact_match |
a logical value with the default value |
verbose |
a logical value with default |
... |
further arguments to the for |
Details
It is a sub-function to use in the get_eurostat_data
to generate url for the given filters
and date_filter
in that function. The output can be used also for filtering data
on the local computer with the get_eurostat_raw
and filter_raw_data
function, if the direct response from REST API did not provide data because of too large data set.
Value
a data.table containing in each row a distinct filtering condition to be applied to a raw Eurostat datatable or generate specific query.
If date_filter=TRUE
, the output data table contains two columns with the following names:
sd | Starting date to be included in the filtered dataset, where date is formatted yyyy[-mm][-dd] |
ed | End date of the period to be included in the filtered dataset, where the date is formatted yyyy[-mm][-dd] |
In case date_filter=FALSE
, the output tables have the following four columns:
pattern | Containing those parts of the filters string where the string part (pattern) was found in the dsd |
concept | The name of the concepts corresponding to the result in the code/name column where the pattern was found in the data structure definition |
code | The list of codes where the pattern was found, or the code of a name (description of the code) where the pattern appears |
name | The name (description of the code) which can be used as label for the code where the pattern was found, or the name (description of the code) of the code where the pattern appears |
See Also
get_eurostat_raw
, search_eurostat_dsd
, get_eurostat_data
, filter_raw_data
Examples
if (!(grepl("amzn|-aws|-azure ",Sys.info()['release']))) options(timeout=2)
dsd<-get_eurostat_dsd("avia_par_me")
create_filter_table(c("KYIV","hu","Quarterly"),dsd=dsd,exact_match=FALSE,ignore.case=TRUE)
create_filter_table(c("KYIV","LHBP","Monthly"),dsd=dsd,exact_match=FALSE,name=FALSE)
create_filter_table(c("2017-03",
"2001-03:2005",
"<2000-07-01",
2012:2014,
"2018<",
20912,
"<3452<",
":2018-04>",
"2<034v",
"2008:2013"),
date_filter=TRUE,
verbose=TRUE)
options(timeout=60)