diff --git a/r-package/DESCRIPTION b/r-package/DESCRIPTION index ed557b54..f8a66e07 100644 --- a/r-package/DESCRIPTION +++ b/r-package/DESCRIPTION @@ -32,6 +32,7 @@ Depends: R (>= 3.5.0) Imports: curl, + dplyr (>= 0.8-3), data.table, httr (>= 1.4.1), methods, @@ -41,7 +42,6 @@ Suggests: arrow (>= 15.0.1), censobr (>= 0.3.2), covr, - dplyr (>= 0.8-3), ggplot2 (>= 3.3.1), knitr, rmarkdown, diff --git a/r-package/NEWS.md b/r-package/NEWS.md index f0b74c8c..49f3082a 100644 --- a/r-package/NEWS.md +++ b/r-package/NEWS.md @@ -6,9 +6,13 @@ - Function `read_urban_area()` now has a new parameter `code_state`, which will allow users to filter selected states. Closes #338 - Function `read_metro_area()` now has a new parameter `code_state`, which will allow users to filter selected states. Closes #338 +**Bug fix** +- Using `data.table::rbindlist()` to rind data was throwing errors when some observations were of class `POLYGONS` and others were `MULTIPOLYGONS`. This has now been replaced with `dplyr::bind_rows()` at a very small performance penalty. Closes #346. + **New data** - schools for 2023 - health facilities for 202303 +- census tracts for 2020 and 2022 # geobr v1.8.2 diff --git a/r-package/R/utils.R b/r-package/R/utils.R index 4aea6144..6e05a65d 100644 --- a/r-package/R/utils.R +++ b/r-package/R/utils.R @@ -283,7 +283,8 @@ load_gpkg <- function(temps=NULL){ # read files and pile them up files <- lapply(X=temps, FUN= sf::st_read, quiet=TRUE) - temp_sf <- sf::st_as_sf(data.table::rbindlist(files, fill = TRUE)) # do.call('rbind', files) + # temp_sf <- sf::st_as_sf(data.table::rbindlist(files, fill = TRUE)) # do.call('rbind', files) + temp_sf <- dplyr::bind_rows(files) # closes issue 284 col1 <- names(temp_sf)[1]