Search code examples
rleafletraster

ISO-3 of all the countries in R


I am trying to make a map that looks like this so where can I get the ISO-3 of all the countries. many thanks in advance.


Solution

  • You could use this code:

    library(rnaturalearth)
    countries <- ne_countries()
    countries@data[["iso_a3"]]
    

    More info about the package rnaturalearth: https://docs.ropensci.org/rnaturalearth/articles/rnaturalearth.html