Skip to content

Commit

Permalink
Merge pull request #116 from rOpenSpain/sianetest
Browse files Browse the repository at this point in the history
More robust column selection on `esp_get_prov_siane()`
  • Loading branch information
dieghernan authored Nov 20, 2024
2 parents 9e0ad12 + 7dc25da commit 0e8b18e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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", , "[email protected]", role = c("aut", "cre", "cph"),
comment = c(ORCID = "0000-0001-8457-4658", affiliation = "rOpenSpain"))
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
9 changes: 8 additions & 1 deletion R/esp_get_prov.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0e8b18e

Please sign in to comment.