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
redist_plans(plans, map, algorithm, wgt = NULL, ...)
a matrix with
n_precinct columns and
or a single vector of precinct assignments.
the algorithm used to generate the plans (usually "smc" or "mcmc")
the weights to use, if any.
Other named attributes to set
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
As a data frame, the usual
dplyr methods will work.
Other useful methods for
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.rsg(): Automated Redistricting Starts #> #> #> 4 districts built using 99 precincts in 0.04 seconds... #> redist_plans(rsg_plan, iowa, "rsg") #> A <redist_plans> containing 1 sampled plan #> Plans have 4 districts from a 99-unit map, and were drawn using random #> seed-and-grow. #> Plans matrix: int [1:99, 1] 4 4 3 1 4 3 2 4 3 3 ... #> # A tibble: 4 × 3 #> draw district total_pop #> * <fct> <int> <dbl> #> 1 1 1 749754 #> 2 1 2 783969 #> 3 1 3 785724 #> 4 1 4 726908