redist_map: Create a 'redist_map' object.

View source: R/redist_map.R

redist_mapR Documentation

Create a redist_map object.

Description

Sets up a redistricting problem.

Usage

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)

Arguments

...

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.

existing_plan

<tidy-select> the existing district assignment. Must be numeric or convertible to numeric.

pop_tol

<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.

total_pop

<tidy-select> the vector of precinct populations. Defaults to the pop, population, or total_pop columns, if one exists.

ndists

<data-masking> the integer number of districts to partition the map into. Must be specified if existing_plan is not supplied.

pop_bounds

<data-masking> more specific population bounds, in the form of c(lower, target, upper).

adj

the adjacency graph for the object. Defaults to being computed from the data if it is coercible to a shapefile.

adj_col

the name of the adjacency graph column

planarize

a number, indicating the CRS to project the shapefile to if it is latitude-longitude based. Set to NULL or FALSE to avoid planarizing.

x

an object to be coerced

Details

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

Value

A redist_map object

Examples

data(fl25)
d <- redist_map(fl25, ndists = 3, pop_tol = 0.05, total_pop = pop)
dplyr::filter(d, pop >= 10e3)


redist documentation built on June 24, 2024, 9:10 a.m.