Learn R Programming

mapSpain (version 0.1.2)

esp_get_prov: Get Provinces boundaries of Spain

Description

Loads a simple feature (sf) object containing the province boundaries of Spain.

Usage

esp_get_prov(prov = NULL, ...)

Arguments

prov

A vector of names and/or codes for provinces or NULL to get all the provinces. See Details.

...

Additional parameters from esp_get_nuts.

Value

A POLYGON/POINT object.

Details

When using prov you can use and mix names and NUTS codes (levels 1, 2 or 3), ISO codes (corresponding to level 2 or 3) or cpro.

Ceuta and Melilla are considered as provinces on this dataset.

When calling a superior level (Autonomous Community or NUTS1) , all the provinces of that level would be added.

See Also

esp_get_hex_prov, esp_get_nuts, esp_get_ccaa, esp_get_munic, esp_codelist

Examples

Run this code
# NOT RUN {
library(sf)

# Random Provinces

Random <-
  esp_get_prov(prov = c("Zamora",
                        "Palencia",
                        "ES-GR",
                        "ES521",
                        "01"))
plot(st_geometry(Random), col = hcl.colors(6))

# All Provinces of a Zone plus an addition

Mix <-
  esp_get_prov(prov = c("Noroeste",
                        "Castilla y Leon", "La Rioja"),
               resolution = "20")
plot(
  Mix[, "nuts1.code"],
  pal = hcl.colors(3),
  key.pos = NULL,
  main = NULL,
  border = "white"
)
# }

Run the code above in your browser using DataLab