country_codes: ISO-3166 three letter country codes with United Nations...

country_codesR Documentation

ISO-3166 three letter country codes with United Nations regions and European Union membership

Description

International Organisation for Standardisation three letter codes for the representation of country names taken from the ISOcodes package , associated with UN regions taken from United Nations website, and whether the country is the member of the European Union.

Usage

country_codes

Format

A tibble with 250 rows and 4 variables.

alpha_3

ISO_3166_1 country code.

country_name

Name of country.

un_region_name

Name of United Nations region.

eu_member

Whether the country is a member of the European Union or not.

Details

The missing old European country Yugoslavia was added, along with the UN regions for one Americas country BES Bonaire, Sint Eustatius and Saba, and three Asian countries HKG Hong Kong, MAC Macao and TWN Taiwan, Province of China.

Figures

country_codes_table.png

Examples

suppressPackageStartupMessages({
 suppressWarnings({
  library(dplyr)
  library(gt)
  library(here)
  library(fs)
  library(pagedown)
 })
})

# create figures directory
dir_create(path(tempdir(), "figures"))

# create html table
country_codes %>%
  filter(un_region_name == "Europe") %>%
  gt(groupname_col = "un_region_name") %>%
  tab_header(title = md("**ISO-3166 three letter country codes**"),
             subtitle = md("*European countries including European Union membership*")) %>%
  cols_hide(eu_member) %>%
  tab_style(
    style = list(
      cell_fill(color = "#000099"), # Pantone Reflex Blue
      cell_text(color = "#FFCC00")), # Pantone Yellow
    locations = cells_body(rows = eu_member == TRUE)
  ) %>%
 tab_options(
    heading.align = "left",
    heading.background.color = "#2C3E50",
    column_labels.hidden = TRUE,
    row_group.font.weight = "bold",
    row_group.background.color = "#2C3E50",
    table.width = pct(50),
    table.font.size = "smaller",
    data_row.padding = px(0)
  ) %>%
  opt_table_lines("none") %>%
  gtsave(path(tempdir(), "figures", "country_codes_table.html"))

# convert to image
chrome_print(path(tempdir(), "figures", "country_codes_table.html"),
           format = "png")

# move image
if(dir_exists(here("man", "figures"))) {
  file_move(path(tempdir(), "figures", "country_codes_table.png"),
            here("man", "figures", "country_codes_table.png"))
}

gcfrench/store documentation built on May 17, 2024, 5:52 p.m.