Learn R Programming

redist (version 4.2.0)

redist_constr: Set up constraints for sampling

Description

redist_constr objects are used to specify constraints when sampling redistricting plans with redist_smc() and redist_mergesplit(). Each constraint is specified as a function which scores a given plan. Higher scores are penalized and sampled less frequently.

Usage

redist_constr(map = tibble())

Value

a redist_constr object, which is just a list with a certain nested structure.

Arguments

map

a redist_map() object; the map that will be used in sampling

Details

The redist_constr object keeps track of sampling constraints in a nested list. You can view the exact structure of this list by calling str(). Constraints may be added by using one of the following functions:

  • add_constr_compet()

  • add_constr_custom()

  • add_constr_edges_rem()

  • add_constr_fry_hold()

  • add_constr_grp_hinge()

  • add_constr_grp_inv_hinge()

  • add_constr_grp_pow()

  • add_constr_incumbency()

  • add_constr_log_st()

  • add_constr_multisplits()

  • add_constr_polsby()

  • add_constr_pop_dev()

  • add_constr_segregation()

  • add_constr_splits()

  • add_constr_status_quo()

  • add_constr_total_splits()

More information about each constraint can be found on the relevant constraint page.

Examples

Run this code
data(iowa)
map_ia <- redist_map(iowa, existing_plan = cd_2010, pop_tol = 0.01)
constr <- redist_constr(map_ia)
constr <- add_constr_splits(constr, strength = 1.5, admin = region)
print(constr)

Run the code above in your browser using DataLab