Skip to content

Commit

Permalink
fix empty geometry bug
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherkenny committed Mar 20, 2024
1 parent a552cea commit e5859aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# censable 0.0.6

* Fixes an error where `build_dec()` and `build_acs()` fail when `geography = 'state'`.
* Fixes an error where empty geometries are returned with `county = NULL` for some `geography` entries.

# censable 0.0.5

Expand Down
3 changes: 3 additions & 0 deletions R/api.R
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ get_geometry <- function(geography, ...) {
if (geography == 'blocks' && 'county' %in% names(list(...)) && is.null(list(...)[['county']])) {
args[['county']] <- NULL
}
if ('county' %in% names(args) && is.null(args[['county']])) {
args <- args[-which(names(args) == 'county')]
}
do.call(fn, args) %>%
dplyr::rename_with(.fn = function(x) stringr::str_sub(x, end = -3),
.cols = dplyr::any_of(c('GEOID20', 'GEOID10', 'GEOID00'))) %>%
Expand Down

0 comments on commit e5859aa

Please sign in to comment.