[R-sig-Geo] How to neighbours list functions match coords?
Lee Hachadoorian
Lee.Hachadoorian+L at gmail.com
Tue Nov 9 19:51:59 CET 2010
The example from the documentation for nbdists() uses two predefined
objects (columbus and col.gal.nb), so it's not clear to me how
coordinates are being matched (see below)
library(spdep)
example(columbus)
coords <- coordinates(columbus)
dlist <- nbdists(col.gal.nb, coords)
Does nbdists() match coordinates via location or row name? Or does it
rely on the ordering of the objects? What I would like to do is go from
a SpatialPolygonsDataFrame to neighbourslist to nbdist as follows:
nb = poly2nb(columbus, row.names = columbus$COLUMBUS_I, queen = FALSE)
nbdist = nbdists(nb, coords = coordinates(columbus), longlat = TRUE)
Is this reliable?
This question would apply similarly to any neighbours list function with
a coords parameter, e.g. plot.nb or nb2lines.
Thanks,
--Lee
--
Lee Hachadoorian
PhD Student, Geography
Program in Earth & Environmental Sciences
CUNY Graduate Center
More information about the R-sig-Geo
mailing list