redist_plans: A set of redistricting plans

View source: R/redist_plans.R

redist_plansR Documentation

A set of redistricting plans

Description

A redist_plans object is essentially a data frame of summary information on each district and each plan, along with the matrix of district assignments and information about the simulation process used to generate the plans.

Usage

redist_plans(plans, map, algorithm, wgt = NULL, ...)

Arguments

plans

a matrix with n_precinct columns and n_sims rows, or a single vector of precinct assignments.

map

a redist_map object

algorithm

the algorithm used to generate the plans (usually "smc" or "mcmc")

wgt

the weights to use, if any.

...

Other named attributes to set

Details

The first two columns of the data frame will be draw, a factor indexing the simulation draw, and district, an integer indexing the districts within a plan. The data frame will therefore have n_sims*ndists rows. As a data frame, the usual dplyr methods will work.

Other useful methods for redist_plans objects:

  • summary.redist_plans

  • add_reference

  • subset_sampled

  • subset_ref

  • pullback

  • number_by

  • match_numbers

  • is_county_split

  • prec_assignment

  • plan_distances

  • get_plans_matrix

  • get_plans_weights

  • get_sampling_info

  • as.matrix.redist_plans

  • plot.redist_plans

Value

a new redist_plans object.

Examples

data(iowa)

iowa <- redist_map(iowa, existing_plan = cd_2010, pop_tol = 0.05, total_pop = pop)
rsg_plan <- redist.rsg(iowa$adj, iowa$pop, ndists = 4, pop_tol = 0.05)$plan
redist_plans(rsg_plan, iowa, "rsg")


redist documentation built on April 3, 2023, 5:46 p.m.