Learn R Programming

restatapi (version 0.6.0)

search_eurostat_dsd: Search the downloaded 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 with the character string with the id of the dataset.

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.

Value

If the pattern found then the function returns table 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

Otherwise returns the value FALSE.

Details

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

See Also

get_eurostat_dsd, search_eurostat_toc.

Examples

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab