Last chance! 50% off unlimited learning
Sale ends in
From an nb list and point geometry, return a list of distances for each observation's neighbors list.
st_nb_dists(x, nb, longlat = NULL)
a list where each element is a numeric vector.
an object of class sfc
.
a neighbor list for example created by st_contiguity()
TRUE
if point coordinates are longitude-latitude decimal degrees, in which case distances are measured in kilometers. See ?spdep::nbdists()
for more.
Utilizes spdep::nbdists()
for distance calculation.
Other weights:
st_inverse_distance()
,
st_kernel_weights()
,
st_weights()
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