st_nb_dists: Calculate neighbor distances

View source: R/nb_dists.R

st_nb_distsR Documentation

Calculate neighbor distances

Description

From an nb list and point geometry, return a list of distances for each observation's neighbors list.

Usage

st_nb_dists(x, nb, longlat = NULL)

Arguments

x

an object of class sfc.

nb

a neighbor list for example created by st_contiguity()

longlat

TRUE if point coordinates are longitude-latitude decimal degrees, in which case distances are measured in kilometers. See ?spdep::nbdists() for more.

Details

Utilizes spdep::nbdists() for distance calculation.

Value

a list where each element is a numeric vector.

See Also

Other weights: st_inverse_distance(), st_kernel_weights(), st_weights()

Examples

geo <- sf::st_geometry(guerry)
nb <- st_contiguity(geo)
dists <- st_nb_dists(geo, nb)

head(dists)

sfdep documentation built on Jan. 11, 2023, 9:08 a.m.