rfrnds | R Documentation |
Downloads the referendum data from the Referendum Database (RDB). See the codebook
for a detailed description of all variables.
rfrnds(
country_code = NULL,
subnational_entity_name = NULL,
municipality = NULL,
level = NULL,
type = NULL,
date_min = NULL,
date_max = NULL,
is_draft = FALSE,
date_time_created_min = NULL,
date_time_created_max = NULL,
date_time_last_edited_min = NULL,
date_time_last_edited_max = NULL,
query_filter = NULL,
incl_archive = FALSE,
tidy = TRUE,
use_cache = TRUE,
max_cache_age = "1 week",
use_testing_server = pal::pkg_config_val(key = "use_testing_server", pkg = this_pkg),
quiet = FALSE
)
country_code |
The |
subnational_entity_name |
The |
municipality |
The |
level |
The |
type |
The |
date_min |
The minimum |
date_max |
The maximum |
is_draft |
|
date_time_created_min |
The minimum |
date_time_created_max |
The maximum |
date_time_last_edited_min |
The minimum |
date_time_last_edited_max |
The maximum |
query_filter |
A valid MongoDB JSON query filter document which allows for
maximum control over what data is included. This takes precedence over all of the above listed parameters, i.e. if |
incl_archive |
Whether or not to include an |
tidy |
Whether or not to tidy the referendum data, i.e. apply various data cleansing tasks and add additional variables. If |
use_cache |
Whether or not to return cached results if possible. If |
max_cache_age |
Duration after which cached results are refreshed (i.e. newly fetched). A valid lubridate duration. Use |
use_testing_server |
Whether or not to use the testing servers instead of the production servers for RDB Services API calls etc. |
quiet |
Whether or not to suppress printing status output from internal processing. |
A tibble.
Other referendum data functions:
add_rfrnds()
,
assert_vars()
,
count_rfrnds()
,
delete_rfrnds()
,
download_file_attachment()
,
edit_rfrnds()
,
rfrnd()
,
rfrnd_exists()
,
rfrnds_bkp()
,
validate_rfrnds()
# get all referendums (excl. drafts)
rdb::rfrnds()
# get only referendums in Austria and Australia on subnational level
rdb::rfrnds(country_code = c("AT", "AU"),
level = "subnational",
quiet = TRUE)
# get referendums in 2020
rdb::rfrnds(date_min = "2020-01-01",
date_max = "2020-12-31",
quiet = TRUE)
# get referendums added to the database during the last 30 days
rdb::rfrnds(date_time_created_min = clock::date_today(zone = "UTC") |> clock::add_days(-30L),
date_time_created_max = clock::date_today(zone = "UTC"),
quiet = TRUE)
# provide custom `query_filter` for more complex queries like regex matches
# cf. https://docs.mongodb.com/manual/reference/operator/query/regex/
rdb::rfrnds(query_filter = '{"country_code":{"$regex":"A."}}',
quiet = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.