Augments data
with an additional column country_code_continual
holding the current or future ISO 3166-1 alpha-2 code of the country where the referendum took place. If the country still exists,
country_code_continual
is identical to country_code
, otherwise it is the country_code
of the successor country. If the country was succeeded by
multiple countries, the code of the largest one in terms of population is taken.
Arguments
- data
RDB referendum data as returned by
rfrnds()
. A data frame that at minimum contains the columncountry_code
(with ISO 3166-1 alpha-2 or ISO 3166-3 alpha-4 codes).
Value
A tibble.
See also
Other referendum data augmentation functions:
add_country_code_long()
,
add_country_name()
,
add_country_name_long()
,
add_former_country_flag()
,
add_period()
,
add_turnout()
,
add_urls()
,
add_world_regions()
Examples
rdb::rfrnds(quiet = TRUE) |>
rdb::add_country_code_continual() |>
dplyr::select(id,
starts_with("country_"))
#> # A tibble: 17,866 × 4
#> id country_code country_name country_code_continual
#> <chr> <fct> <fct> <fct>
#> 1 6694f97dc3cd67046057fed1 CH Switzerland CH
#> 2 66856a7bc3cd67046057fe61 SI Slovenia SI
#> 3 66856972c3cd67046057fe5a SI Slovenia SI
#> 4 66856835c3cd67046057fe53 SI Slovenia SI
#> 5 66856659c3cd67046057fe4b SI Slovenia SI
#> 6 6659b208c3cd67046057fe31 CH Switzerland CH
#> 7 6659b140c3cd67046057fe2d CH Switzerland CH
#> 8 6659af29c3cd67046057fe29 CH Switzerland CH
#> 9 6659ae82c3cd67046057fe25 CH Switzerland CH
#> 10 6659ad59c3cd67046057fe21 CH Switzerland CH
#> # ℹ 17,856 more rows