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
PL94171 ingests Census P.L. 94-171 redistricting data — the official data file used for redistricting after each decennial Census. It provides block-level population and race/ethnicity counts required to meet equal-population and Voting Rights Act standards.
library(PL94171)
# Download P.L. 94-171 data for a state
md_data <- pl_raw('MD', year = 2020) # 2020 Census redistricting file
# Process into a tidy format
md_tidy <- pl_tidy(md_data)
The P.L. 94-171 file has three tables:
| Table | Contents |
|---|---|
| P1 | Race alone (total population) |
| P2 | Hispanic or Latino + race (total population) |
| P3 | Race alone (18+ voting-age population) |
| P4 | Hispanic or Latino + race (18+ voting-age population) |
# Access specific tables
p1 <- pl_tidy(md_data, table = 'P1') # total population by race
p3 <- pl_tidy(md_data, table = 'P3') # VAP by race
After processing with pl_tidy():
| Variable | Description |
Next to this one in the catalogue, plus more from the same author.