Create Plots of Shapes by Group with Connected Components Colored
geo_plot_group(shp, adj, group, save = FALSE, path = "")
Arguments
- shp
An sf shapefile
- adj
adjacency list
- group
array of group identifiers. Typically district numbers or county names.
- save
Boolean, whether to save or not.
- path
Path to save, only used if save is TRUE. Defaults to working directory.
Examples
library(dplyr)
data('checkerboard')
data('checkerboard_adj')
checkerboard <- checkerboard |> mutate(discont = as.integer(j == 5 | j == 6))
p <- geo_plot_group(checkerboard, checkerboard_adj, checkerboard$discont)
p[[1]]
p[[2]]