tally {redistmetrics}R Documentation

Tally a Column by District

Description

Helper function to aggregate a vector by district. Can be used to calculate total population, group percentages, and more.

Usage

tally(plans, shp, x)

Arguments

plans

A redist_plans object or plans_matrix where each row indicates a district assignment and each column is a plan.

shp

A redist_map object, tibble, or data frame containing other columns.

x

The numeric vector to tally.

Value

A numeric vector with the tallies. Can be shaped into a district-by-plan matrix.

Examples

data(nh)
data(nh_m)

tally(nh_m, nh, pop) # total population
tally(nh_m, nh, vap_hisp) / tally(nh_m, nh, vap) # HVAP


[Package redistmetrics version 1.0.7 Index]