inc_pairs: Count Incumbent Pairings

Description Usage Arguments Value Examples

View source: R/incumbent.R

Description

Count the number of incumbents paired with at least one other incumbent.

Usage

1
inc_pairs(plans, shp, inc)

Arguments

plans

redist_plans object or plans_matrix where each row indicates a district assignment and each column is a plan

shp

redist_map object or tibble with sf geometry column

inc

unqouted name of logical column in shp indicating where incumbents live

Value

vector of number of incumbents paired

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(nh)
data(nh_m)
# Use incumbent data:
fake_inc <- rep(FALSE, nrow(nh))
fake_inc[3:4] <- TRUE

# For a single plan:
inc_pairs(plans = nh$r_2020, shp = nh, inc = fake_inc)

# Or many plans:
inc_pairs(plans = nh_m[, 3:5], shp = nh, inc = fake_inc)

redistmetrics documentation built on Dec. 20, 2021, 5:07 p.m.