Learn R Programming

redist (version 4.2.0)

avg_by_prec: 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)

Value

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

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.