redist_map
object.Sets up a redistricting problem.
redist_map(
...,
existing_plan = NULL,
pop_tol = NULL,
total_pop = c("pop", "population", "total_pop", "POP100"),
ndists = NULL,
pop_bounds = NULL,
adj = NULL,
adj_col = "adj",
planarize = 3857
)as_redist_map(x)
A redist_map object
column elements to be bound into a redist_map
object or a
single list
or data.frame
. These will be passed on to the
tibble
constructor.
<tidy-select>
the
existing district assignment. Must be numeric or convertible to numeric.
<data-masking>
the population tolerance.
The percentage deviation from the average population will be constrained to
be no more than this number. If existing_plan
is provided, defaults to
the parity of that plan; otherwise, defaults to 0.01.
<tidy-select>
the vector
of precinct populations. Defaults to the pop
, population
, or
total_pop
columns, if one exists.
<data-masking>
the integer number of
districts to partition the map into. Must be specified if existing_plan
is not supplied.
<data-masking>
more specific
population bounds, in the form of c(lower, target, upper)
.
the adjacency graph for the object. Defaults to being computed from the data if it is coercible to a shapefile.
the name of the adjacency graph column
a number, indicating the CRS to project the shapefile to if it is latitude-longitude based. Set to NULL or FALSE to avoid planarizing.
an object to be coerced
A redist_map
object is a tibble
which contains an
adjacency list and additional information about the number of districts and
population bounds. It supports all of the dplyr
generics, and will
adjust the adjacency list and attributes according to these functions; i.e.,
if we filter
to a subset of units, the graph will change to subset to
these units, and the population bounds will adjust accordingly. If an
existing map is also attached to the object, the number of districts will
also adjust. Subsetting with `[`
and `[[`
does not recompute
graphs or attributes.
Other useful methods for redist_map
objects:
merge_by
get_adj
plot.redist_map
data(fl25)
d <- redist_map(fl25, ndists = 3, pop_tol = 0.05, total_pop = pop)
dplyr::filter(d, pop >= 10e3)
Run the code above in your browser using DataLab