Learn R Programming

mapping (version 1.2)

loadCoordEU: Get European coordinates

Description

Loads and returns names, id, and coordinates for European countries, to use with mapping functions and other "map" functions that accept an sf object.

Usage

loadCoordEU(unit = c("nuts0", "nuts1", "nuts2", "nuts3", "urau"),
            year = c("2021","2016", "2013", "2010", "2006", "2003"),
            scale = c("20", "60"), unit_subset = NULL,
            matchWith = NULL, dir = NULL,
            use_cache = TRUE, use_internet = TRUE, crs = NULL)

Arguments

unit

the type of European statistical unit to link

year

year of the analysis

scale

the scale of the map

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/dataallaround/geospatial. If FALSE the maps downloaded during package installation will be used

crs

coordinate reference system. Look at st_crs

Value

A data.frame object with columns indicating names, ids, iso and the geometries to map.

Details

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

If unit is not specified, borders of the European countries are loaded.

References

https://github.com/dataallaround/geospatial

See Also

loadCoordIT, loadCoordWR

Examples

Run this code
# NOT RUN {
EU_coords = loadCoordEU(unit = "nuts0")
str(EU_coords)

library(tmap)
tm_shape(EU_coords) + tm_borders()

library(mapview)
mapview(EU_coords)

coords_eu_it_de <- loadCoordEU(unit = "nuts0", unit_subset = c("italy", "germany"))


# }

Run the code above in your browser using DataLab