st_force_join_nb {sfislands}R Documentation

Enforce contiguity between pairs of areas

Description

Enforce contiguity between pairs of areas

Usage

st_force_join_nb(nb, x = NULL, y = NULL, xy_df = NULL)

Arguments

nb

a neighbourhood '"list"' or '"matrix"', or an 'sf' dataframe with a neighbourhood column called '"nb"'.

x

name or number of first area (optional if 'xy_df' is provided).

y

name or number of second area (optional if 'xy_df' is provided).

xy_df

(optional) a dataframe with two columns: 'x' and 'y', containing the names or numbers of areas to join.

Value

An amended neighbourhood '"list"', '"matrix"', or 'sf' dataframe with a neighbourhood column called '"nb"'.

Examples

# For individual x and y
st_bridges(uk_election,"constituency_name") |>
st_force_join_nb(x = "Gower", y = "Bridgend")

# For multiple x and y pairse") |>
st_bridges(uk_election,"constituency_name") |>
st_force_join_nb(xy_df = data.frame(
x = c("Gower", "Llanelli"),
y = c("Bridgend", "Vale Of Glamorgan")))

[Package sfislands version 1.1.2 Index]