Skip to contents

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

Usage

loadCoordFR(unit = c("region"), year = c("2021", "2020", "2019"), 
            unit_subset = NULL, matchWith = NULL, dir = NULL, 
            use_cache = TRUE, use_internet = TRUE, crs = NULL)

Arguments

unit

the type of Italian statistical unit to link

year

year of the analysis

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

Details

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

If unit is not specified, country borders are loaded.

Value

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

Examples


# \donttest{
FR_coords = loadCoordFR(unit = "region", year = "2020")
str(FR_coords)
#> Classes ‘sf’, ‘FR’ and 'data.frame':	18 obs. of  4 variables:
#>  $ code    : chr  "04" "94" "02" "11" ...
#>  $ region  : chr  "la r\xe9union" "corse" "martinique" "\xeele-de-france" ...
#>  $ nuts2   : chr  "fr94" "fr83" "fr92" "fr10" ...
#>  $ geometry:sfc_MULTIPOLYGON of length 18; first list element: List of 7
#>   ..$ :List of 1
#>   .. ..$ : num [1:11185, 1:2] 55.2 55.2 55.2 55.2 55.2 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:120, 1:2] 55.6 55.6 55.6 55.6 55.6 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:15, 1:2] 55.3 55.3 55.3 55.3 55.3 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:7, 1:2] 55.8 55.8 55.8 55.8 55.8 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:5, 1:2] 55.8 55.8 55.8 55.8 55.8 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:5, 1:2] 55.8 55.8 55.8 55.8 55.8 ...
#>   ..$ :List of 1
#>   .. ..$ : num [1:5, 1:2] 55.8 55.8 55.8 55.8 55.8 ...
#>   ..- attr(*, "class")= chr [1:3] "XY" "MULTIPOLYGON" "sfg"
#>  - attr(*, "sf_column")= chr "geometry"
#>  - attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA
#>   ..- attr(*, "names")= chr [1:3] "code" "region" "nuts2"
#>  - attr(*, "unit")= chr "region"
#>  - attr(*, "colID")= chr "region"

# }