
String matching of official country names and ISO-3 codes according to the United Nations nomenclature
Source:R/ots_strings_processing.R
ots_country_code.Rd
Takes a text string and searches within the package data for a country code in the context of valid API country codes.
Value
A single character if there is a exact match (e.g.
ots_country_code("Chile")
) or a tibble in case of multiple matches
(e.g. ots_country_code("Germany")
)
Examples
ots_country_code("Chile ")
#> country_iso country_name_english country_fullname_english continent_id
#> 1: chl Chile Chile 5
#> continent_name_english
#> 1: Americas
ots_country_code("america")
#> country_iso country_name_english
#> 1: usa USA
#> country_fullname_english
#> 1: USA, Puerto Rico and US Virgin Islands (excludes Virgin Islands until 1981)
#> continent_id continent_name_english
#> 1: 5 Americas
ots_country_code("UNITED STATES")
#> Empty data.table (0 rows and 5 cols): country_iso,country_name_english,country_fullname_english,continent_id,continent_name_english
ots_country_code(" united_")
#> country_iso country_name_english
#> 1: tza United Rep. of Tanzania
#> 2: umi United States Minor Outlying Islands
#> 3: are United Arab Emirates
#> 4: gbr United Kingdom
#> country_fullname_english continent_id continent_name_english
#> 1: United Rep. of Tanzania 3 Africa
#> 2: United States Minor Outlying Islands 5 Americas
#> 3: United Arab Emirates 1 Asia
#> 4: United Kingdom 2 Europe