add_world_regions: Add UN world regions to referendum data

add_world_regionsR Documentation

Add UN world regions to referendum data

Description

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 code

  • un_region_tier_1_code: UN tier-1 region's M49 area code

  • un_region_tier_1_name: UN tier-1 region's English name

  • un_region_tier_2_code: UN tier-2 region's M49 area code

  • un_region_tier_2_name: UN tier-2 region's English name

  • un_region_tier_3_code: UN tier-3 region's M49 area code

  • un_region_tier_3_name: UN tier-3 region's English name

  • un_subregion: Combinatiorial English UN subregion name which, except for Northern Europe, corresponds to the lowest ⁠un_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.

Usage

add_world_regions(data, add_un_country_code = TRUE)

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).

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_"))

zdaarau/c2d documentation built on Dec. 18, 2024, 1:24 p.m.