Skip to contents

Augments data with an additional column holding the current or former three-letter ISO 3166-1 alpha-3 code of the country in which the referendum took place (see ISO 3166-3 for former country codes).

Usage

add_country_code_long(data)

Arguments

data

RDB referendum data as returned by rfrnds(). A data frame that at minimum contains the column country_code (with ISO 3166-1 alpha-2 or ISO 3166-3 alpha-4 codes).

Value

A tibble.

Examples

rdb::rfrnds(quiet = TRUE) |>
  rdb:::add_country_code_long() |>
  dplyr::select(id,
                starts_with("country_"))
#> # A tibble: 17,893 × 4
#>    id                       country_code country_code_long country_name 
#>    <chr>                    <fct>        <fct>             <fct>        
#>  1 675aa6786053de6f432eefa8 CH           CHE               Switzerland  
#>  2 670cd145c3cd67046058015c CH           CHE               Switzerland  
#>  3 66fff490c3cd670460580111 LI           LIE               Liechtenstein
#>  4 66ffdfe3c3cd6704605800fc CH           CHE               Switzerland  
#>  5 66ffdc31c3cd6704605800ee CH           CHE               Switzerland  
#>  6 66ffd956c3cd6704605800ec CH           CHE               Switzerland  
#>  7 66ffbf93c3cd6704605800df CH           CHE               Switzerland  
#>  8 66f686cfc3cd6704605800a0 CH           CHE               Switzerland  
#>  9 66f68317c3cd67046058009c CH           CHE               Switzerland  
#> 10 66d6da9cc3cd670460580053 CH           CHE               Switzerland  
#> # ℹ 17,883 more rows