R/lookup.R
country_codes.Rd
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.
country_codes
A tibble with 250 rows and 4 variables.
ISO_3166_1 country code.
Name of country.
Name of United Nations region.
Whether the country is a member of the European Union or not.
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.
suppressPackageStartupMessages({ library(store) 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")) }