Learn R Programming

redistmetrics (version 1.0.11)

comp_log_st: Calculate Log Spanning Tree Compactness

Description

Calculate Log Spanning Tree Compactness

Usage

comp_log_st(plans, shp, counties = NULL, adj)

Value

A numeric vector. Can be shaped into a district-by-plan matrix.

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 with an sf geometry column.

counties

column name in shp containing counties

adj

Zero-indexed adjacency list. Not required if a redist_map is supplied for shp.

References

Cory McCartan and Kosuke Imai. 2020. Sequential Monte Carlo for Sampling Balanced and Compact Redistricting Plans.

Examples

Run this code
data(nh)
data(nh_m)
# For a single plan:
comp_log_st(plans = nh$r_2020, shp = nh, counties = county, adj = nh$adj)

# Or many plans:
comp_log_st(plans = nh_m[, 3:5], shp = nh, counties = county, adj = nh$adj)

Run the code above in your browser using DataLab