diff --git a/DESCRIPTION b/DESCRIPTION index 1c7c1b9b..21554d62 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: mapSpain Title: Administrative Boundaries of Spain -Version: 0.9.2 +Version: 0.9.2.9000 Authors@R: person("Diego", "Hernangómez", , "diego.hernangomezherrero@gmail.com", role = c("aut", "cre", "cph"), comment = c(ORCID = "0000-0001-8457-4658", affiliation = "rOpenSpain")) diff --git a/NEWS.md b/NEWS.md index 71f4ac96..66f7a793 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# mapSpain (development version) + +- Fix a bug on `esp_get_prov_siane()` when selecting columns #115. + # mapSpain 0.9.2 - **SIANE 2024 Update**: Adapt functions to new databases. diff --git a/R/esp_get_prov.R b/R/esp_get_prov.R index a429f225..2957ab97 100644 --- a/R/esp_get_prov.R +++ b/R/esp_get_prov.R @@ -349,11 +349,18 @@ esp_get_prov_siane <- function(prov = NULL, year = Sys.Date(), epsg = "4258", colnames(esp_get_prov()) )) + # Review this error, can't fully reproduce + + namesend <- namesend[namesend %in% names(data_sf)] + data_sf <- data_sf[, namesend] if (isFALSE(rawcols)) { - data_sf <- data_sf[, colnames(esp_get_prov())] + nm <- colnames(esp_get_prov()) + nm <- nm[nm %in% colnames(data_sf)] + + data_sf <- data_sf[, nm] } return(data_sf)