[R-sig-Geo] nb file using spdep tools only
Philip A. Viton
viton.1 at osu.edu
Wed Sep 5 18:42:11 CEST 2007
(Very new-user problem, sorry) Can anyone help me with generating an
nb file using only R/spdep tools, ie without using GeoDa as an
intermediate step? I have a shape file, say "myshape.shp" with its
associated (eg) dbf files. My idea is to read it with maptools, then
convert to polygons, neighbors, then finally weights.
In R (2.5.1 under Winxp):
library(spdep)
map <-readshape("myshape")
# seems OK
mappoly <-Map2poly(map,region.id="OBJECTID")
# also seems OK, though it takes a LONG time
mapnb = poly2nb(mappoly,row.names = NULL,
snap=sqrt(.Machine$double.eps), queen=TRUE)
# problem is, this hangs R (GUI says "Not responding")
(then, if I ever get this far, use nb2listw to generate the weights).
The shape file is a US-48-states file, so not, I would assume, too
big; but obviously something is going wrong. Can anyone suggest a better way?
Thanks!
------------------------
Philip A. Viton
City Planning, Ohio State University
275 West Woodruff Avenue, Columbus OH 43210
viton.1 at osu.edu
More information about the R-sig-Geo
mailing list