Skip to contents

Downloads a single referendum's data from the Referendum Database (RDB). See the codebook for a detailed description of all variables.

Usage

rfrnd(
  id,
  incl_archive = FALSE,
  tidy = TRUE,
  use_testing_server = pal::pkg_config_val(key = "use_testing_server", pkg = this_pkg)
)

Arguments

id

Referendum's unique identifier.

incl_archive

Whether or not to include an archive column containing data from an earlier, obsolete state of the Referendum Database (RDB).

tidy

Whether or not to tidy the referendum data, i.e. apply various data cleansing tasks and add additional variables. If FALSE, the raw MongoDB referendum data will only be modified just enough to be able to return it as a tibble. Note that untidy data doesn't conform to the codebook (i.a. different variable names).

use_testing_server

Whether or not to use the testing servers instead of the production servers for RDB Services API calls etc.

Value

A tibble.

Examples

rdb::rfrnd(id = "5bbbe26a92a21351232dd73f")
#> # A tibble: 1 × 67
#>   id    id_official id_sudd country_code country_name subnational_entity_n…¹ municipality level date       is_former_country title_en title_de title_fr question
#>   <chr> <chr>       <chr>   <fct>        <fct>        <chr>                  <chr>        <ord> <date>     <lgl>             <chr>    <chr>    <chr>    <chr>   
#> 1 5bbb… 5           NA      CH           Switzerland  NA                     NA           nati… 1866-01-14 NA                Tax and… Besteue… Impôts … NA      
#> # ℹ abbreviated name: ¹​subnational_entity_name
#> # ℹ 53 more variables: question_en <chr>, committee_name <chr>, result <fct>, subterritories_yes <dbl>, subterritories_no <dbl>, electorate_total <int>,
#> #   electorate_abroad <int>, votes_yes <int>, votes_no <int>, votes_empty <int>, votes_invalid <int>, votes_per_subterritory <list>, lower_house_yes <int>,
#> #   lower_house_no <int>, lower_house_abstentions <int>, upper_house_yes <int>, upper_house_no <int>, upper_house_abstentions <int>, position_government <fct>,
#> #   topics_tier_1 <list>, topics_tier_2 <list>, topics_tier_3 <list>, remarks <chr>, files <list>, sources <chr>, is_draft <lgl>, date_time_created <dttm>,
#> #   date_time_last_edited <dttm>, type <fct>, inst_legal_basis_type <ord>, inst_has_urgent_legal_basis <lgl>, inst_is_binding <lgl>,
#> #   inst_is_counter_proposal <lgl>, inst_is_assembly <lgl>, inst_trigger_type <fct>, inst_trigger_actor <fct>, inst_trigger_actor_level <ord>, …