Get European coordinates
loadCoordEU.Rd
Loads and returns names, id, and coordinates for European countries, to use with mapping
functions and other "map" functions that accept an sf
object.
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/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 EU folder https://github.com/mappinguniverse/geospatial/tree/master/EU.
If unit
is not specified, borders of the European countries are loaded.
Examples
EU_coords = loadCoordEU(unit = "nuts0")
str(EU_coords)
#> Classes ‘sf’, ‘EU’ and 'data.frame': 37 obs. of 8 variables:
#> $ id : chr "FR" "HR" "HU" "AL" ...
#> $ country : chr "France" "Croatia" "Hungary" "Albania" ...
#> $ iso2 : chr "FR" "HR" "HU" "AL" ...
#> $ iso3 : chr "FRA" "HRV" "HUN" "ALB" ...
#> $ country_code: int 250 191 348 8 40 56 100 756 196 203 ...
#> $ nuts0_id : chr "FR" "HR" "HU" "AL" ...
#> $ nuts0 : chr "France" "Croatia" "Hungary" "Albania" ...
#> $ geometry :sfc_MULTIPOLYGON of length 37; first list element: List of 6
#> ..$ :List of 1
#> .. ..$ : num [1:21, 1:2] 8.67 8.85 8.8 8.83 9.21 ...
#> ..$ :List of 1
#> .. ..$ : num [1:312, 1:2] 2.3 2.09 1.61 1.57 1.64 ...
#> ..$ :List of 1
#> .. ..$ : num [1:6, 1:2] -1.43 -1.41 -1.41 -1.44 -1.46 ...
#> ..$ :List of 1
#> .. ..$ : num [1:7, 1:2] -1.46 -1.51 -1.57 -1.54 -1.47 ...
#> ..$ :List of 1
#> .. ..$ : num [1:6, 1:2] -2.33 -2.27 -2.23 -2.24 -2.33 ...
#> ..$ :List of 1
#> .. ..$ : num [1:6, 1:2] -3.22 -3.11 -3.16 -3.25 -3.26 ...
#> ..- attr(*, "class")= chr [1:3] "XY" "MULTIPOLYGON" "sfg"
#> - attr(*, "sf_column")= chr "geometry"
#> - attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA NA NA NA NA
#> ..- attr(*, "names")= chr [1:7] "id" "country" "iso2" "iso3" ...
#> - attr(*, "unit")= chr "nuts0"
#> - attr(*, "colID")= chr "nuts0"
coords_eu_it_de <- loadCoordEU(unit = "nuts0", unit_subset = c("italy", "germany"))
str(coords_eu_it_de)
#> Classes ‘sf’, ‘EU’ and 'data.frame': 2 obs. of 8 variables:
#> $ id : chr "DE" "IT"
#> $ country : chr "Germany" "Italy"
#> $ iso2 : chr "DE" "IT"
#> $ iso3 : chr "DEU" "ITA"
#> $ country_code: int 276 380
#> $ nuts0_id : chr "DE" "IT"
#> $ nuts0 : chr "Germany" "Italy"
#> $ geometry :sfc_MULTIPOLYGON of length 2; first list element: List of 10
#> ..$ :List of 1
#> .. ..$ : num [1:257, 1:2] 9.03 8.64 8.65 8.86 8.88 ...
#> ..$ :List of 1
#> .. ..$ : num [1:7, 1:2] 11.2 11.1 11 11 11.1 ...
#> ..$ :List of 1
#> .. ..$ : num [1:5, 1:2] 8.56 8.55 8.68 8.7 8.56 ...
#> ..$ :List of 1
#> .. ..$ : num [1:6, 1:2] 8.6 8.43 8.39 8.49 8.57 ...
#> ..$ :List of 1
#> .. ..$ : num [1:5, 1:2] 8.47 8.38 8.46 8.53 8.47 ...
#> ..$ :List of 1
#> .. ..$ : num [1:5, 1:2] 8.36 8.26 8.33 8.38 8.36 ...
#> ..$ :List of 1
#> .. ..$ : num [1:5, 1:2] 8.38 8.33 8.27 8.38 8.38 ...
#> ..$ :List of 1
#> .. ..$ : num [1:5, 1:2] 7.89 7.8 7.92 7.94 7.89 ...
#> ..$ :List of 1
#> .. ..$ : num [1:6, 1:2] 6.85 6.81 6.84 6.9 6.93 ...
#> ..$ :List of 1
#> .. ..$ : num [1:5, 1:2] 6.64 6.66 6.79 6.75 6.64 ...
#> ..- attr(*, "class")= chr [1:3] "XY" "MULTIPOLYGON" "sfg"
#> - attr(*, "sf_column")= chr "geometry"
#> - attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA NA NA NA NA
#> ..- attr(*, "names")= chr [1:7] "id" "country" "iso2" "iso3" ...
#> - attr(*, "unit")= chr "nuts0"
#> - attr(*, "colID")= chr "nuts0"