Displaying 1 result from an estimated 1 matches for "nb_mat".
Did you mean:
nb2mat
2011 May 07
1
spdep::poly2nb problem
...or 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 out that Florida seems to have zero neighbors.
I then repeated i...