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
redistmetrics computes plan-level and district-level metrics for evaluating redistricting plans. All functions work with integer vectors, matrices, or redist_plans objects. In mutate() pipelines, use pl() as the pronoun for the plan assignment.
pl() PronounInside mutate() on a redist_plans object, pl() returns the current plan assignments. This is the standard way to compute metrics across an ensemble:
plans <- plans |>
mutate(
polsby = comp_polsby(pl(), map), # district-level (vector per plan)
fk = comp_frac_kept(pl(), map) # plan-level scalar per plan
)
Geometric compactness measures (Polsby-Popper, Schwartzberg) require perimeter calculations. Precompute once and pass the result to all geometric metrics:
perim_df <- prep_perims(map) # returns a data frame; expensive to compute
plans <- plans |>
mutate(
polsby = comp_polsby(pl(), map, perim_df = perim_df),
schw = comp_schwartzberg(pl(), map, perim_df = perim_df)
)
These measure the shape of district boundaries. Higher = more compact.
Most commonly used. Ratio of district area to the area of a circle with the same perimeter. Range: (0, 1].
Next to this one in the catalogue, plus more from the same author.