Counts the number of referendums per level in the Referendum Database (RDB).
Usage
count_rfrnds(
is_draft = FALSE,
country_code = NULL,
subnational_entity_name = NULL,
municipality = NULL,
level = NULL,
type = NULL,
date_min = NULL,
date_max = NULL,
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,
use_testing_server = funky::config_val("use_testing_server")
)Arguments
- is_draft
TRUEmeans to include only referendum entries with draft status,FALSEto include only normal entries. Set toNULLin order to include both draft and normal entries.- country_code
The
country_code(s) to be included. A character vector.- subnational_entity_name
The
subnational_entity_name(s) to be included. A character vector.- municipality
The
municipality(s) to be included. A character vector.- level
The
level(s) to be included. A character vector.- type
The
type(s) to be included. A character vector.- date_min
The minimum
dateto be included. A date or something coercible to.- date_max
The maximum
dateto be included. A date or something coercible to.- date_time_created_min
The minimum
date_time_createdto be included. A datetime, or something coercible to (like"2006-01-02"or"2006-01-02T15:04:05Z"; assumed to be in UTC if no timezone is given).- date_time_created_max
The maximum
date_time_createdto be included. A datetime, or something coercible to (like"2006-01-02"or"2006-01-02T15:04:05Z"; assumed to be in UTC if no timezone is given).- date_time_last_edited_min
The minimum
date_time_last_editedto be included. A datetime, or something coercible to (like"2006-01-02"or"2006-01-02T15:04:05Z"; assumed to be in UTC if no timezone is given).- date_time_last_edited_max
The maximum
date_time_last_editedto be included. A datetime, or something coercible to (like"2006-01-02"or"2006-01-02T15:04:05Z"; assumed to be in UTC if no timezone is given).- 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
query_filteris provided, the parameterscountry_code,subnational_entity_name,municipality,level,type,date_min,date_max,is_draft,date_time_created_min,date_time_created_max,date_time_last_edited_minanddate_time_last_edited_maxare ignored.- use_testing_server
Whether or not to use the testing servers instead of the production servers for RDB Services API calls etc.
See also
Other referendum data functions:
add_rfrnds(),
assert_vars(),
delete_rfrnds(),
download_file_attachment(),
edit_rfrnds(),
rfrnd(),
rfrnd_exists(),
rfrnds(),
rfrnds_bkp(),
validate_rfrnds()
Examples
# the whole database (excl. drafts)
rdb::count_rfrnds()
#> $local
#> [1] 43
#>
#> $national
#> [1] 3135
#>
#> $subnational
#> [1] 14714
#>
# only Swiss and Austrian referendums
rdb::count_rfrnds(country_code = c("CH", "AT"))
#> $local
#> [1] 1
#>
#> $national
#> [1] 694
#>
#> $subnational
#> [1] 6930
#>
# only Swiss referendums created between 2020 and 2021
rdb::count_rfrnds(country_code = "CH",
date_time_created_min = "2020-01-01",
date_time_created_max = "2021-01-01")
#> $local
#> [1] 0
#>
#> $national
#> [1] 9
#>
#> $subnational
#> [1] 105
#>