Learn R Programming

SchoolDataIT (version 0.2.4)

Get_Shapefile: Download the shapefiles of Italian NUTS-3 and LAU administrative units

Description

Downloads either the boundaries or the centroids of the relevant administrative units, either provinces or municipalities, from the ISTAT website. Geometries are expressed in meters.

Usage

Get_Shapefile(
  Year,
  level = "LAU",
  lightShp = TRUE,
  autoAbort = FALSE,
  centroids = FALSE
)

Value

A spatial data frame of class data.frame and sf.

Arguments

Year

Numeric. Reference year for the administrative units.

level

Character. Either "LAU"/"Municipality", "NUTS-3"/"Province", "NUTS-2"/"Region", . "LAU" by default

lightShp

Logical. If TRUE, the function downloads a generalised, i.e.less detailed, and lighter version of the shapefiles. TRUE by default.

autoAbort

Logical. Whether to automatically abort the operation and return NULL in case of missing internet connection or server response errors. FALSE by default.

centroids

Logical. Whether to switch from polygon geometry to point geometry. In the latter case, the point is located at the centroid of the relevant area. FALSE by default.

Examples

Run this code

# \donttest{
  library(magrittr)


  Prov23_shp <- Get_Shapefile(2023, lightShp = TRUE, level = "NUTS-3", autoAbort = TRUE)
  ggplot2::ggplot() + ggplot2::geom_sf(data = Prov23_shp) +
    ggplot2::ggtitle("Italian provinces in 2023/01/01")
 # }


Run the code above in your browser using DataLab