Calculate Manhattan Distances
dist_man(plans, ncores = 1)
Arguments
- plans
A redist_plans
object or plans_matrix where each row indicates a district assignment and each column is a plan.
- ncores
Integer number of cores to use. Default is 1.
Value
matrix of plan distances
Examples
data(nh)
data(nh_m)
# For a single plan (distance is trivial, 0):
dist_man(plans = nh$r_2020)
#> [1] 0
# Or many plans:
dist_man(plans = nh_m[, 3:5])
#> [,1] [,2] [,3]
#> [1,] 0 233 272
#> [2,] 233 0 99
#> [3,] 272 99 0