match_numbers: Renumber districts to match an existing plan
Description
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, using the Hungarian algorithm.
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.
Arguments
data
a redist_plans object.
plan
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.
total_pop
a vector of population counts. Should not be needed for most
redist_plans objects.
col
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.
renumbering options in any plan.