Learn R Programming

redistmetrics (version 1.0.11)

inc_pairs: Count Incumbent Pairings

Description

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

Usage

inc_pairs(plans, shp, inc)

Value

vector of number of incumbents paired

Arguments

plans

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

shp

A redist_map object, tibble, or data frame containing other columns.

inc

Unqouted name of logical column in shp indicating where incumbents live.

Examples

Run this code
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)

Run the code above in your browser using DataLab