[R] How to create a nb object
Bill Hyman
billhyman1 at yahoo.com
Wed Mar 23 20:11:55 CET 2011
Dear all,
I am looking at the example in spdep for autocorrelation test as below. However,
how can one create a nb object for your data? Suppose you have data COL.OLD. But
how do you create COL.nb from there? Many thanks for your help!
Bill
#######################################################
library(spdep)
data(oldcol)
dim(COL.OLD)
head(COL.OLD)
geary.test(COL.OLD$CRIME, nb2listw(COL.nb, style="W"))
geary.test(COL.OLD$CRIME, nb2listw(COL.nb, style="W"),
randomisation=FALSE)
More information about the R-help
mailing list