Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Runs redistricting analysis in R with the redistverse packages, covering data loading, simulation, constraints, metrics and visualization.
45% 86%+41 ptsof test cases passed
Passed 19 of 22 test cases with the skill, and 10 of 22 without it.
To obtain official Census Bureau Block Assignment Files (BAF) for state legislative redistricting reconciliation in R, which package provides a direct function to download these BAF files?
The response recommends using the baf package.
3 of 3 safety checks passed
This file covers the non-compactness, non-partisan metrics in redistmetrics: administrative splits, population parity, minority group representation, segregation, competitiveness, and incumbent pairings.
Measures how evenly population is distributed across districts. Usually the first metric to check after simulation.
plans <- plans |>
mutate(parity = plan_parity(pl(), map))
# Returns max absolute deviation from equal population, as a fraction
# e.g., 0.004 means worst district is 0.4% from ideal
# Number of counties split into 2+ pieces
plans <- plans |>
mutate(county_splits = splits_admin(pl(), map, admin = map$county))
# Number of counties split into 3+ pieces
plans <- plans |>
mutate(county_multi = splits_multi(pl(), map, admin = map$county))
# Total number of county-district pieces (sum of pieces across all counties)
plans <- plans |>
mutate(county_total = splits_total(pl(), map, admin = map$county))
The admin argument accepts any column that identifies administrative units (counties, municipalities, school districts, etc.).
# Municipal splits
plans <- plans |>
Next to this one in the catalogue, plus more from the same author.