alarm-redist / redist

Simulation methods for legislative redistricting.
https://alarm-redist.github.io/redist/
GNU General Public License v2.0
66 stars 23 forks source link

Filtering all the rows of a `redist_map` errors #182

Closed CoryMcCartan closed 7 months ago

CoryMcCartan commented 7 months ago

When we check the population bounds on a filtered redist_map we are implicitly assuming that at least one row exists. Need to handle the case where 0 rows are returned.

redist:::ld_ia()

dplyr::filter(ia, FALSE)
#> Error in if (bounds[1] > new_tgt || bounds[3] < new_tgt) { :
#>   missing value where TRUE/FALSE needed
christopherkenny commented 7 months ago

~Should it error? For comparison, is it possible to create a 0-row sf tibble?~ Looks like sf handles it, so we probably should too