countries: Countries from naturalearth

View source: R/functions.R

countriesR Documentation

Countries from naturalearth

Description

Select a set of countries; talking about countries, we mean either sovereign countries, parts of countries and dependencies, each of these cathegories being on each own row. A single or a set of countries can be obtained by indicating a set of names of, either countries, regions or subregions

Usage

countries(
  name = NA,
  part = FALSE,
  dependency = FALSE,
  indeterminate = FALSE,
  exclude = NULL,
  include = NULL,
  utm = FALSE,
  crs = NULL,
  towns = FALSE,
  capital = FALSE,
  lang = NULL,
  extend = 1,
  shift = FALSE,
  coastlines = TRUE
)

Arguments

name

a character vector that contains one or several countries, regions or subregions (mixing the two of the three cathegories will result as an error),

part

should the parts of the countries be included (eg Azsores for Portugal or Alaska for the United States of America),

dependency

should the dependencies of the countries be included (eg Greenland and the Faroe Islands for Denmark),

indeterminate

should the indeterminate territories be included,

exclude

an optional set of countries that should be excluded from the request,

include

an optional set of countries that should be included

utm

if TRUE, the geometry is transformed using the relevant utm projection, if an integer, the geometry is transformed using the utm projection for the zone indicated,

crs

a CRS

towns

if TRUE, a tibble containing the cities of the countries selected is returned as a "towns" attribute,

capital

if TRUE the tibble containing the cities of the countries selected will contain the capitals, whatever their size,

lang

the language for countries and towns, one of "en", "fr", "es", '"it"

extend

a number >= 1, extend the bounding box so that the background is larger than the initial bounding box and can be transformed correctly if utm transformation is required

shift

a boolean, if TRUE, st_shift_longitude is used

coastlines

a boolean, TRUE to get the background coastines

Value

an object of class countries which inherits from sf with the following columns:

  • id the two letters identifier of the country,

  • type either "main" (the main part of a sovereign country, the whole country for most of them) - country the name of the entity,

  • sovereign the sovereign country the entity belongs to,

  • capital the name of the capital of the country (NA for parts and dependencies) - subregion the name of the subregion (United Nations' definition)

  • pop the population of the entity,

  • gdp currently undocumented

  • wbreg the name of the region (World Bank's definition)

  • region the name of the region (United Nations' definition) Two attributes "type" and "towns"

Examples

countries("Western Europe")

necountries documentation built on April 4, 2025, 1:43 a.m.