Augments data
with information about the United Nations (UN) geoscheme on three different
grouping tiers based on the UN M49 area code hierarchy.
In total, eight different columns are added:
un_country_code
: UN M49 country codeun_region_tier_1_code
: UN tier-1 region's M49 area codeun_region_tier_1_name
: UN tier-1 region's English nameun_region_tier_2_code
: UN tier-2 region's M49 area codeun_region_tier_2_name
: UN tier-2 region's English nameun_region_tier_3_code
: UN tier-3 region's M49 area codeun_region_tier_3_name
: UN tier-3 region's English nameun_subregion
: Combinatiorial English UN subregion name which, except for Northern Europe, corresponds to the lowestun_region_tier_*_name
.
Tier-1 regions are the highest, i.e. most aggregated UN regions, commonly referred to as continents. Tier-2 regions are also known as "subregions" and tier-3 regions as "sub-subregions".
Only part of all UN tier-2 regions are further divided into UN tier-3 regions, meaning that not all countries are part of a UN tier-3 region. If a country
doesn't belong to any UN tier-3 region, the corresponding un_region_tier_3_*
values will simply be NA
. The un_subregion
column specifically addresses
this issue by providing a uniform combination of un_region_tier_2_name
and un_region_tier_3_name
.
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).- add_un_country_code
Whether or not to also add a column
un_country_code
holding the UN M49 code of the country in which the referendum took place.
Value
A tibble.
See also
Other referendum data augmentation functions:
add_country_code_continual()
,
add_country_code_long()
,
add_country_name()
,
add_country_name_long()
,
add_former_country_flag()
,
add_period()
,
add_turnout()
,
add_urls()
Examples
rdb::rfrnd(id = "5bbbe26a92a21351232dd73f") |>
rdb::add_world_regions() |>
dplyr::select(id,
starts_with("country_"),
starts_with("un_"))
#> # A tibble: 1 × 11
#> id country_code country_name un_country_code un_region_tier_1_code un_region_tier_1_name un_region_tier_2_code un_region_tier_2_name un_region_tier_3_code
#> <chr> <fct> <fct> <fct> <fct> <fct> <fct> <fct> <fct>
#> 1 5bbbe… CH Switzerland 756 150 Europe 155 Western Europe NA
#> # ℹ 2 more variables: un_region_tier_3_name <fct>, un_subregion <fct>