Suggests nearest neighbors for connecting a disconnected group.
suggest_component_connection(shp, adj, group, epsg = 3857)
tibble with two columns of suggested rows of shp to connect in adj
library(dplyr)
data(checkerboard)
checkerboard <- checkerboard |> filter(i != 1, j != 1)
adj <- adjacency(checkerboard)
#> Warning: Planarizing skipped. `x` missing CRS.
suggest_component_connection(checkerboard, adj)
#> Warning: Planarizing skipped. `x` missing CRS.
#> Warning: Planarizing skipped. `x` missing CRS.
#> # A tibble: 3 × 2
#> x y
#> <int> <int>
#> 1 2 9
#> 2 1 2
#> 3 1 8