avg_by_prec: Average a variable by precinct

View source: R/plans_helpers.R

avg_by_precR Documentation

Average a variable by precinct

Description

Takes a column of a redist_plans object and averages it across a set of draws for each precinct.

Usage

avg_by_prec(plans, x, draws = NA)

Arguments

plans

a redist_plans object

x

an expression to average. Tidy-evaluated in plans.

draws

which draws to average. NULL will average all draws, including reference plans. The special value NA will average all sampled draws. An integer, logical, or character vector indicating specific draws may also be provided.

Value

a vector of length matching the number of precincts, containing the average.


redist documentation built on June 24, 2024, 9:10 a.m.