ISO 2 Brief Country Code in R.

#Use countrycode function to convert countrynames to ISO-2 char codes
countrycode::countrycode(sourcevar = c("United Kingdom", "Malaysia"),
                         origin = "country.name", destination = "iso2c")
Successful Salmon