Skip to content
Prev 11279 / 29559 Next

spdep: show neighbors from "dnearneigh"

On Tue, 22 Mar 2011, Kevin Ringelman wrote:

            
But listw2mat doesn't - see ?nb2mat. For the direct route, see ?nb2listw, 
and ?listw2sn:

ds <- nbdists(us48.q, as.matrix(as.data.frame(state.center))[m50.48,],
   longlat=TRUE)
# here using a matrix of state centroids - geographical coordinates
lw <- nb2listw(us48.q, glist=ds, style="B")
res <- listw2sn(lw)
res[1:9,]
# with distances in this case in Great Circle km.

Roger