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,766 × 4
#>    id                       country_code country_code_long country_name
#>    <chr>                    <fct>        <fct>             <fct>       
#>  1 65096e84481d20233932cc70 PL           POL               Poland      
#>  2 65096dc1481d20233932cc6e PL           POL               Poland      
#>  3 65096535481d20233932cc66 PL           POL               Poland      
#>  4 6509625d481d20233932cc63 PL           POL               Poland      
#>  5 650034e4481d20233932cc39 AU           AUS               Australia   
#>  6 64e46f7a481d20233932cc0b EC           ECU               Ecuador     
#>  7 64e46c8f481d20233932cc09 FM           FSM               Micronesia  
#>  8 64c8b3ca0b8bae0c78c7ec8a FM           FSM               Micronesia  
#>  9 64c8b19c0b8bae0c78c7ec86 FM           FSM               Micronesia  
#> 10 64c8a28d0b8bae0c78c7ec82 FM           FSM               Micronesia  
#> # ℹ 17,756 more rows