jennybc/gapminder

Possible enhacement: include ISO 3166-1 alpha-3 codes

luifrancgom opened this issue · 1 comments

Hello Jenny Bryan

Thank your for creating this package.

I want to know if it is possible to include ISO 3166-1 alpha-3 codes for the countries. I use your package to experiment and taught the tidyverse ecosystem.

I want to use also your package to taught how to create maps but the names of the countries in gapminder::gapminder are not good when trying to merger with datasets that contains information about geometries to create maps.

For example some countries like USA are pointed out as United States or United States of America so sometimes we lose information where it is better to identify a country by a standard code:

library(tidyverse)
library(rnaturalearth)

gapminder::gapminder %>%
  filter(year == 2007) %>% 
  right_join(y = ne_countries(scale = 10,
                              type = "countries",
                              returnclass = "sf") %>%
               select(adm0_a3, admin, geometry),
             by = c("country" = "admin")) %>% 
  ggplot() +
  geom_sf(aes(geometry = geometry, fill = lifeExp))

Created on 2021-08-10 by the reprex package (v2.0.1)

Sorry for bothering you I always use the gapminder directly. I didn't see the country_codes.

Please ignore this request.