District numbers in simulated plans are by and large random. This function attempts to renumber the districts across all simulated plans to match the numbers in a provided plan.
match_numbers(data, plan, col = "pop_overlap", force = FALSE)
a redist_plans
object
a character vector giving the name of the plan to match to (e.g., for a reference plan), or an integer vector containing the plan itself.
the name of a new column to store the vector of population overlap
with the reference plan: the fraction of the total population who are in
the same district under each plan and the reference plan. Set to
NULL
if no column should be created.
if TRUE
, force computation when there are more than 1,000
renumbering options in any plan.
a modified redist_plans
object. New district numbers will be
stored as an ordered factor variable in the district
column. The
district numbers in the plan matrix will match the levels of this factor.