The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Version: 0.1-1
Date: 2024-11-14
Title: Countries of the World
Depends: R (≥ 4.0.0)
Imports: Rdpack, tibble, ggplot2, sf, dplyr, ggrepel, rlang, classInt, stringr, magrittr, stringi
Description: Based on Natural Earth https://www.naturalearthdata.com/, a subset of countries can easily be selected with their administrative boundaries, joined with an external data frame and plotted as a thematic map.
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
Encoding: UTF-8
URL: https://www.R-project.org
RoxygenNote: 7.3.1
Author: Yves Croissant ORCID iD [aut, cre]
Maintainer: Yves Croissant <yves.croissant@univ-reunion.fr>
LazyData: true
NeedsCompilation: no
Suggests: knitr, tidyr, purrr, quarto
VignetteBuilder: quarto
RdMacros: Rdpack
Packaged: 2024-11-14 12:12:10 UTC; yves
Repository: CRAN
Date/Publication: 2024-11-15 09:00:10 UTC

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:

Examples

countries("Western Europe")

Methods for dplyr's verbs

Description

countries' objects inherits from sf, when a verb of dlpyr is used, the returned object is of class sf; these methods return a countries object.

Usage

check_join(x, y, by = NULL, side = c("right", "both", "left"))

## S3 method for class 'countries'
select(.data, ...)

## S3 method for class 'countries'
left_join(
  x,
  y,
  by = NULL,
  copy = FALSE,
  suffix = c(".x", ".y"),
  ...,
  keep = NULL
)

Arguments

x, y, by, copy, suffix, keep

see dplyr::left_join

side

for the check_join function

.data

see dplyr::select

...

further arguments

Value

for the select and the left_join method, a data frame


Compute a unique sf to optimize the position of labels

Description

Displaying labels on a map is complicated because of serious overlapping problems. Labels for different kinds of entities can be put in a unique sf

Usage

## S3 method for class 'countries'
labels(object, ..., var)

Arguments

object

a countries object',

...

further arguments (currently unused),

var

a character vector indicating the entities that should be labeleld, it can be country, capital and towns

Value

a sf containing:


Countries of naturalearth

Description

A sf containing 299 countries (in a large sense), either the main parts of sovereign countries, parts or dependencies

Format

a sf containing


Populated places of naturalearth

Description

A sf containing 7342 cities

Format

a sf containing


Basic plot function for countries objects

Description

As the plot method of sf, this function is intended to obtain quickly a map for a set of countries. Countries' boundaries are represented and filling can be used, some cities can also be represented and labels can be added. ggplot is used and should be used directly when more enhanced maps are required

Usage

## S3 method for class 'countries'
plot(
  x,
  ...,
  labels = NULL,
  fill = NULL,
  capital = NULL,
  centroid = NULL,
  bks = NULL,
  n = 6,
  style = NULL,
  palette = NULL,
  bw = FALSE
)

Arguments

x

a countries object,

...

further arguments (currently unused)

labels

a character vector containing the variables that should be labeled: country, capital and/or towns

fill

a variable use to fill countries' polygons

capital, centroid

a variable associated with the shape or the size of points

bks

an optional vector of breaks in order to use a continuous variable for fill

n

the number of class (passed to classIntervals)

style

the style (passed to classIntervals)

palette

the palette (selected in scale_fill_brewer)

bw

a boolean, if TRUE, a black and white map is produced

Value

a gg object.

Examples

we <- countries("Western Europe")
plot(we)

Objects exported from other packages

Description

These objects are imported from other packages. Follow the links below to see their documentation.

dplyr

left_join, select

magrittr

%>%


Slave trade and economic development

Description

a cross-section of 52 countries from 2000

Format

a tibble containing:

Source

Nathan Nunn's website https://nathannunn.arts.ubc.ca/

References

Nunn N (2008). “The Long-Term Effects of Africa's Slave Trades.” The Quarterly Journal of Economics, 123(1), 139–176. ISSN 00335533, 15314650, https://www.jstor.org/stable/25098896.


Solow's growth model with spatial correlation

Description

a cross-section of 91 countries from 1995

Format

a tibble containing:

Source

JAE data archive

References

Ertur C, Koch W (2007). “Growth, technological interdependence and spatial externalities: theory and evidence.” Journal of Applied Econometrics, 22(6), 1033-1062. doi:10.1002/jae.963, https://onlinelibrary.wiley.com/doi/pdf/10.1002/jae.963, https://onlinelibrary.wiley.com/doi/abs/10.1002/jae.963.


Populated places from naturalearth

Description

Select a set of cities; the set can be defined using the id of the country, the fact that it is a capital and the size

Usage

towns(x, size = NULL, capital = FALSE, crs = NULL, shift = FALSE)

Arguments

x

a sf (typically computed using the countries function), or a character that is passed to countries,

size

the minimum size of the cities that have to be retrieved (the default value is NULL and all the cities are retrieved)

capital

if TRUE always retrieve the capitals, even if their size is below the one specified using the size argument

crs

an optional crs which is passed to st_transform

shift

a boolean, if TRUE, st_shift_longitude is used

Value

a sf containing five columns:

Examples

we <- countries("Western Europe")
towns(we, size = 1E06, capital = TRUE)

Universal Transverse Mercator projection

Description

utm returns the relevant UTM crs (in the 'proj4string' form)

Usage

utm(x)

Arguments

x

either an integer (from 1L to 60L) or a 'sf

Details

There is one utm projections for each of the 60 zones that divide the world. The zone can be indicated as an integer (ie 12L, and not 12) or can be computed from a sf object

Value

a character string

a character (a crs i, the 'proj4string' format)

Examples

we <- countries("Western Europe")
utm(we)
utm(32L)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.