powered by
Helper function to aggregate a vector by district. Can be used to calculate total population, group percentages, and more.
tally(plans, shp, x)
A numeric vector with the tallies. Can be shaped into a district-by-plan matrix.
A redist_plans object or plans_matrix where each row indicates a district assignment and each column is a plan.
redist_plans
A redist_map object, tibble, or data frame containing other columns.
redist_map
The numeric vector to tally.
data(nh) data(nh_m) tally(nh_m, nh, pop) # total population tally(nh_m, nh, vap_hisp) / tally(nh_m, nh, vap) # HVAP
Run the code above in your browser using DataLab