Not all relevant geographies nest neatly into Census blocks, including communities of interest or neighborhood. For these cases, this provides a tabulation by district of the number of splits. As some geographies can be split multiple times, the sum of these splits may not reflect the total number of splits.
splits_district_fuzzy(plans, shp, nbr, thresh = 0.01, epsg)
A redist_plans
object or plans_matrix where each row indicates a district assignment and each column is a plan.
A redist_map
object, tibble, or data frame with an sf
geometry column.
Geographic neighborhood, community, or other unit to check splits for.
Percent as decimal of an area to trim away. Default is .01, which is 1%.
Numeric EPSG code to use to project the shapefile, if needed. Default is 3857.
numeric matrix
Beware, this requires a nbr
shape input and will be slower than checking splits in cases where
administrative unit nests cleanly into the geographies represented by shp
.
data(nh)
data(nh_m)
# toy example,
# suppose we care about the splits of the counties and they don't nest
nh_cty <- nh %>% dplyr::group_by(county) %>% dplyr::summarize()
# For a single plan:
splits_district_fuzzy(plans = nh$r_2020, shp = nh, nbr = nh_cty)
#> [,1]
#> [1,] 6
#> [2,] 6
# Or many plans:
splits_district_fuzzy(plans = nh_m[, 3:5], shp = nh, nbr = nh_cty)
#>
#> [1,] 4 4 5
#> [2,] 4 4 5