search_eurostat_dsd {restatapi}R Documentation

Search for pattern in the Data Structure Definition of a dataset

Description

Search the Data Structure Definition (DSD) of a Eurostat dataset for a given pattern. It returns the rows where the pattern appears in the code and name column of the output of the get_eurostat_dsd function.

Usage

search_eurostat_dsd(pattern, dsd = NULL, name = TRUE, exact_match = FALSE, ...)

Arguments

pattern

a character string or a vector of character string.

dsd

a table containing Data Structure Definition (DSD) of a Eurostat dataset which can be retreived by the get_eurostat_dsd function.

name

a boolean with the default value TRUE, if the search shall look for the pattern in the name of the code. If the value FALSE, then only the 'code' column of the DSD will be searched.

exact_match

a boolean with the default value FALSE, if the strings provided in pattern shall be matched exactly as it is or as a pattern.

...

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

Details

The function returns the line(s) where the searched pattern appears in the code or in the name column.

Value

If the pattern found then the function returns a data.frame with the 4 columns:

pattern The pattern which was searched
concept The name of the concepts in the data structure
code The list of codes where the pattern was found, or the code of a name where the pattern appears
name The name/description of the code where the pattern found, or the name of the code where the pattern appears

Otherwise returns the value NULL.

See Also

get_eurostat_dsd, create_filter_table, search_eurostat_toc

Examples



if (!(grepl("amzn|-aws|-azure ",Sys.info()['release']))) options(timeout=2)
dsd_example<-get_eurostat_dsd("nama_10_gdp",verbose=TRUE)
search_eurostat_dsd("EU",dsd_example)
search_eurostat_dsd("EU",dsd_example,ignore.case=TRUE)
search_eurostat_dsd("EU27_2019",dsd_example,name=FALSE)
search_eurostat_dsd("EU27_2019",dsd_example,exact_match=TRUE)
options(timeout=60)


[Package restatapi version 0.23.1 Index]