places_lookup: Helper to look up Country Codes to Import

Description Usage Arguments Details Value Examples

View source: R/places_lookup.R

Description

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.

Usage

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

Arguments

name

A country, region or subregion name.

type

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

Details

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

UN Regions

UN Subregion

UN Intermediate Region

Value

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

Examples

1
2
3
4
5
6
7
8
9
## 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")

## End(Not run)

poldham/places documentation built on Aug. 19, 2019, 8:33 p.m.