| fedstat_data_ids_filter {fedstatAPIr} | R Documentation |
Filters data_ids based on filters that are given in JSON format
Description
Filters indicator data_ids with given filters
taking into account possible filters specification errors and default filters.
filters should use filter_field_title in names and filter_value_title in values as
they are presented on fedstat.ru. If for some reason the specified filters
do not return the expected result, it is worth inspecting possible
filter values in data_ids to see if the strings are defined correctly
(e.g. encoding issues, mixing latin and cyrillic symbols)
filter_value_title currently supports the following special values:
asterix (*), it's alias for "select all possible filter values for this filter field"
Unspecified filters use asterix as a default (i.e. all possible filter values are selected and a warning is given)
Internally normalized filter_field_title and filter_value_title are
used (all lowercase, removed extra whitespaces)
to compare the equality of data_ids and filters
Usage
fedstat_data_ids_filter(data_ids, filters = list(), disable_warnings = FALSE)
Arguments
data_ids |
data.frame, result of |
filters |
JSON in R list form. The structure should be like this:
{
"filter_field_title1": ["filter_value_title1", "filter_value_title2"],
"filter_field_title2": ["filter_value_title1", "filter_value_title2"],
...
}
Where for example |
disable_warnings |
bool, enables or disables following warnings:
|
Value
data.frame, filtered data_ids
See Also
fedstat_get_data_ids,
fedstat_post_data_ids_filtered
Examples
## Not run:
# Get data filters identificators for CPI
# filter the data_ids to get data for january of 2023
# for all goods and services for Russian Federation
data_ids_filtered <- fedstat_get_data_ids("31074") %>%
fedstat_data_ids_filter(
filters = list(
"Territory" = "Russian Federation",
"Year" = "2023",
"Period" = "January",
"Types of goods and services" = "*"
)
)
# Not actual filter field titles and filter values titles because of ASCII requirement for CRAN
## End(Not run)