Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

countryname

Convert country names in any language to another name or code


Description

Converts long country names in any language to one of many different country code schemes or country names. 'countryname' does 2 passes on the data. First, it tries to detect variations of country names in many languages extracted from the Unicode Common Locale Data Repository. Second, it applies ‘countrycode'’s English regexes to try to match the remaining cases.

Usage

countryname(sourcevar, destination = "cldr.short.en", warn = FALSE)

Arguments

sourcevar

Vector which contains the codes or country names to be converted (character or factor)

destination

Coding scheme of destination (string such as "iso3c" enclosed in quotes ""): type '?codelist' for a list of available codes.

warn

Prints unique elements from sourcevar for which no match was found

Details

Note that the function works with non-ASCII characters. Please see the Github page for examples.

Examples

## Not run: 
x <- c('Afaganisitani', 'Barbadas', 'Sverige', 'UK')
countryname(x)
countryname(x, destination = 'iso3c')

## End(Not run)

countrycode

Convert Country Names and Country Codes

v1.2.0
GPL-3
Authors
Vincent Arel-Bundock [aut, cre] (<https://orcid.org/0000-0003-2042-7063>), CJ Yetman [ctb] (<https://orcid.org/0000-0001-5099-9500>), Nils Enevoldsen [ctb] (<https://orcid.org/0000-0001-7195-4117>)
Initial release
2020-05-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.