50% off | Unlimited Data & AI Learning

Last chance! 50% off unlimited learning

Sale ends in


sfdep (version 0.2.5)

st_nb_dists: 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)

Value

a list where each element is a numeric vector.

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.

See Also

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

Examples

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

head(dists)

Run the code above in your browser using DataLab