From an nb list and point geometry, return a list of distances for each observation's neighbors list.
Arguments
- 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 stats:
local_moran()
,
st_lag()
Examples
geo <- sf::st_geometry(guerry)
nb <- st_contiguity(geo)
dists <- st_nb_dists(geo, nb)
#> ! Polygon provided. Using centroid.
head(dists)
#> [[1]]
#> [1] 94.64160 74.87454 60.30202 86.63555
#>
#> [[2]]
#> [1] 78.28331 83.91602 101.63539 83.50560 113.24947 102.12034
#>
#> [[3]]
#> [1] 91.61746 96.06537 105.75084 83.77814 74.36547 107.28314
#>
#> [[4]]
#> [1] 62.02069 106.94545 73.89760 85.87814
#>
#> [[5]]
#> [1] 62.02069 86.61112 85.82790
#>
#> [[6]]
#> [1] 59.20561 86.52618 106.88483 110.30968 64.18030 77.68036 102.18663
#>