nbdists | R Documentation |
Given a list of spatial neighbour links (a neighbours list of object type
nb
), the function returns the Euclidean distances along the links
in a list of the same form as the neighbours list. If longlat = TRUE, Great
Circle distances are used.
nbdists(nb, coords, longlat = NULL)
nb |
an object of class |
coords |
matrix of point coordinates, an object inheriting from SpatialPoints or an |
longlat |
TRUE if point coordinates are longitude-latitude decimal degrees, in which case distances are measured in kilometers; if coords is a SpatialPoints object, the value is taken from the object itself |
A list with class nbdist
Roger Bivand Roger.Bivand@nhh.no
summary.nb
, nb2listw
columbus <- st_read(system.file("shapes/columbus.gpkg", package="spData")[1], quiet=TRUE)
col.gal.nb <- read.gal(system.file("weights/columbus.gal", package="spData")[1])
coords <- st_coordinates(st_centroid(columbus))
dlist <- nbdists(col.gal.nb, coords)
dlist <- lapply(dlist, function(x) 1/x)
stem(unlist(dlist))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.