Learn R Programming

mapping (version 1.4.1)

loadCoordWR: Get worldwide countries coordinates

Description

Loads and returns names, ids, iso, and coordinates for world countries, ready to use with mapping functions and other "map" functions that accept an sf object.

Usage

loadCoordWR(unit = c("country", "nato", "ocde",
                     "continent", "region", "subregion",
                     "region_wb", "type_income", "type_economy"),
            res = c("low", "hi"), unit_subset = NULL,
            matchWith = NULL, dir = NULL, use_cache = TRUE,
            use_internet = TRUE, crs = NULL)

Value

A data.frame object with column indicating names, id, iso and the geometry to map.

Arguments

unit

the type of world statistical unit

res

resolution

unit_subset

character vector of unit names to extract

matchWith

the type of id

dir

local directory in which shape files are stored

use_cache

a logical value indicating whether to use the cache

use_internet

a logical value indicating wheter the coordinates are downloaded from https://github.com/mappinguniverse/geospatial. If FALSE the maps downloaded during package installation will be used.

crs

coordinate reference system. Look at st_crs

Author

Alessio Serafini

Details

Coordinates are download from the Github repo https://github.com/mappinguniverse/geospatial from world folder https://github.com/mappinguniverse/geospatial/tree/master/world.

References

https://github.com/mappinguniverse/geospatial

See Also

loadCoordIT, loadCoordEU, loadCoordUS, loadCoordDE, loadCoordUK

Examples

Run this code


WR_coords = loadCoordWR(res = "low")
str(WR_coords, 1)


WR_ocde = loadCoordWR(unit = "ocde",res = "low")
str(WR_ocde, 1)

WR_continent = loadCoordWR(unit = "continent",res = "low")
str(WR_continent, 1)


Run the code above in your browser using DataLab