Displaying 1 result from an estimated 1 matches for "states_nb".
Did you mean:
state_nr
2011 May 07
1
spdep::poly2nb problem
...nd unzipped it into my working directory.
Then in R (version 12.2.0 for ms-win32):
library(rgdal) # Version: 0.6-28
library(spdep) # Version: 0.5-24 (loads sp: Version: 0.9-72)
# read in the data
states<-readOGR(".","s_01de10")
summary(states)
# now create a neighbors list
states_nb<-poly2nb(states)
# create a 0/1 matrix of the neighbors
nb_mat<-nb2mat(states_nb,style="B",zero.policy=TRUE)
# add names
nms<-as.character(states$NAMES)
# set the matrix names
dimnames(nb_mat)<-list(nms,nms)
# now see which states have no neighbors
rowSums(nb_mat)
# it turns...