Learn R Programming

mapSpain (version 0.1.2)

esp_get_ccaa: Get Autonomous Communities boundaries of Spain

Description

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

Usage

esp_get_ccaa(ccaa = NULL, ...)

Arguments

ccaa

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

...

Additional parameters from esp_get_nuts.

Value

A POLYGON/POINT object.

Details

When using ccaa you can use and mix names and NUTS codes (levels 1 or 2), ISO codes (corresponding to level 2) or codauto. Ceuta and Melilla are considered as Autonomous Communities on this dataset.

When calling a NUTS1 level, all the Autonomous Communities of that level would be added.

See Also

esp_get_hex_ccaa, esp_get_nuts, esp_get_prov, esp_get_munic, esp_codelist

Examples

Run this code
# NOT RUN {
library(sf)

# Random CCAA

Random <-
  esp_get_ccaa(ccaa = c("Euskadi",
                        "Catalunya",
                        "ES-EX",
                        "Canarias",
                        "ES52",
                        "01"))
plot(st_geometry(Random), col = hcl.colors(6))

# All CCAA of a Zone plus an addition

Mix <-
  esp_get_ccaa(ccaa = c("La Rioja", "Noroeste"),
               resolution = "20")
plot(
  Mix[, "nuts1.code"],
  pal = hcl.colors(2),
  key.pos = NULL,
  main = NULL,
  border = "white"
)
# }

Run the code above in your browser using DataLab