Description Usage Arguments Note Examples
Converts long country names into one of many different coding schemes. Translates from one scheme to another. Converts country name or coding scheme to the official short English country name. Creates a new variable with the name of the continent or region to which each country belongs.
1 | countrycode(sourcevar, origin, destination, warn = FALSE)
|
sourcevar |
Vector which contains the codes or country names to be converted |
origin |
Coding scheme of origin (name enclosed in quotes "") |
destination |
Coding scheme of destination (name enclosed in quotes "") |
warn |
Prints unique elements from sourcevar for which no match was found |
Supports the following coding schemes: Correlates of War character, CoW-numeric, ISO3-character, ISO3-numeric, ISO2-character, IMF numeric, International Olympic Committee, FIPS 10-4, FAO numeric, United Nations numeric, World Bank character, official English short country names (ISO), continent, region.
The following strings can be used as arguments for origin
or
destination
: "cowc", "cown", "iso3c", "iso3n", "iso2c", "imf",
"fips104", "fao", "ioc", "un", "wb", "country.name". The following strings can be
used as arguments for destination
only: "continent", "region"
1 2 | codes.of.origin <- countrycode::countrycode_data$cowc # Vector of values to be converted
countrycode(codes.of.origin, "cowc", "iso3c")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.