A helper function to navigate two letter country codes. The geonames dump file places_table uses two letter country codes (iso2c). The places_table includes optional country and region names. If you prefer to look up country codes then use this helper. The function wraps the countrycode lookup function for matching single country names or vectors to two letter country codes. Country and region names are not case sensitive.

places_lookup(name = NULL, type = "country")

Arguments

name

A country, region or subregion name.

type

Either "country", "region", "subregion" or "intermediate"

Value

A vector containing a country name or set of two letter country codes for a region or subregion.

Details

The region, subregion and intermediate searches are mainly intdended for use with the allcountries table to group countries by United Nations regions. The function wraps the countrycode package on CRAN function countrycode

  • Africa

  • Americas

  • Asia

  • Europe

  • Oceania

  • Australia and New Zealand

  • Central Asia

  • Eastern Asia

  • Eastern Europe

  • Latin America and the Caribbean

  • Melanesia

  • Micronesia

  • Northern Africa

  • Northern America

  • Northern Europe

  • Polynesia

  • South-eastern Asia

  • Southern Asia

  • Southern Europe

  • Sub-Saharan Africa

  • Western Asia

  • Western Europe

  • Caribbean

  • Central America

  • Channel Islands

  • Eastern Africa

  • Middle Africa

  • South America

  • Southern Africa

  • Western Africa

Examples

# NOT RUN {
one <- places_lookup("UK", type = "country"),
two <- places_lookup(c("US", "UK"), type = "country"),
two_names <- places_lookup(c("Kenya", "Tanzania"))
upper <- places_lookup("Africa", type = "region")
africa <- places_lookup("africa", type = "region"),
central_asia <- places_lookup("Central Asia", type = "subregion"),
caribbean <- places_lookup("Caribbean", type = "intermediate")
# }