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
censable provides Census data retrieval and standardization tools. It wraps censusapi for common redistricting-oriented requests, with consistent column naming across years and survey types. Requires a Census API key (set with add_r_environ()).
library(censable)
# Decennial Census (redistricting data)
dec_data <- build_dec(
geography = 'block', # 'block', 'tract', 'county', 'state'
state = 'MD',
county = NULL, # optional FIPS code for a single county
year = 2020 # 2000, 2010, or 2020
)
# American Community Survey (5-year estimates)
acs_data <- build_acs(
geography = 'tract',
state = 'MD',
year = 2020
)
# Memoized versions (cached in memory — fast for repeated calls in a session)
dec_data <- mem_build_dec(geography = 'tract', state = 'MD', year = 2020)
acs_data <- mem_build_acs(geography = 'tract', state = 'MD', year = 2020)
Output columns follow the pattern: pop (total), pop_white, pop_black, pop_hisp, pop_asian, pop_aian, pop_nhpi, pop_other and equivalent vap_* columns for voting-age population.
For analyses that use fewer race categories, collapse the detailed columns:
# Collapse to 4 groups: white, black, hispanic, other
df4 <- collapse4(df) # adds/replaces standard columns
Next to this one in the catalogue, plus more from the same author.