Learn R Programming

ohvbd (version 1.0.0)

match_countries: Match country names to their equivalent naturalearth WKT polygons

Description

Match country names to their equivalent naturalearth WKT polygons using rnaturalearth::ne_countries().

Usage

match_countries(countrynames, returnmulti = TRUE, onlywkt = FALSE)

Value

A list containing:

  • $location_wkt: a multipolygon containing all locations (or a named vector of individual country polygons).

  • $missing_locs: any provided countries not found in naturalearth.

  • $found_locs: any provided countries that were found in naturalearth.

Arguments

countrynames

a vector of country names to match to naturalearth.

returnmulti

return the GBIF taxon ids only (otherwise return the full lookup dataframe).

onlywkt

only return location_wkt (see note for more details).

Author

Francis Windram

Examples

Run this code
match_countries(c("United Kingdom", "Germany"))

Run the code above in your browser using DataLab