View source: R/match.country.R
match.country | R Documentation |
Match country
match.country(country, output = "iso", language = "english")
country |
A vector of country names or ISO 3 digit alpha codes |
output |
A column of the MatchCountry table (mc) to return |
language |
The language of the inputs (by default, English; NULL will match on all) languages) |
match |
A csv file to use for matching |
countrydata |
A csv file to use |
This function is designed to recognize different variations of country names and standardize them. For example, "St. Kitts & Nevis", "Saint Kitts & Nevis" and "St Kitts and Nevis" all refer to the same place, but a simple merge with a table would fail to match them all. The database has a table of common alternative names. Further, the algorithm removes extended characters that might lead to confusion (St. vs. Saint, for example). Where a match cannot be found, NA is returned in its place.
If no language is specified, the algorithm will match on all languages, but this is less efficient and could be prone to errors.
The default output is the iso field of the countrydata data frame; any column of the countrydata can be used, however.
A vector with the same length as country with the matching results
match.country("United Republic of Tanzania")
match.country("Tanzania")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.