st_dist_band: Neighbors from a distance band

View source: R/neighbors.R

st_dist_bandR Documentation

Neighbors from a distance band

Description

Creates neighbors based on a distance band. By default, creates a distance band with the maximum distance of k-nearest neighbors where k = 1 (the critical threshold) to ensure that there are no regions that are missing neighbors.

Usage

st_dist_band(geometry, lower = 0, upper = critical_threshold(geometry), ...)

Arguments

geometry

An sf or sfc object.

lower

The lower threshold of the distance band. It is recommended to keep this as 0.

upper

The upper threshold of the distance band. By default is set to a critical threshold using critical_threshold() ensuring that each region has a minimum of one neighbor.

...

Passed to spdep::dnearneigh().

Value

a list of class nb

See Also

Other neighbors: st_contiguity(), st_knn()

Examples

geo <- sf::st_geometry(guerry)
st_dist_band(geo, upper = critical_threshold(geo))

sfdep documentation built on Sept. 13, 2024, 5:07 p.m.