match.country: Match country

View source: R/match.country.R

match.countryR Documentation

Match country

Description

Match country

Usage

match.country(country, output = "iso", language = "english")

Arguments

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

Details

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.

Value

A vector with the same length as country with the matching results

Examples


match.country("United Republic of Tanzania")
match.country("Tanzania")


philbastian/matchcountry documentation built on June 12, 2025, 11:46 p.m.