Skip to content
Prev 12776 / 29559 Next

extracting simple list of adjacent neighbours

On Tue, 13 Sep 2011, Moritz Lennert wrote:

            
example(columbus)
nb <- poly2nb(columbus, row.names=as.character(columbus$NEIGNO))
lw <- nb2listw(nb, style="B")
sn <- listw2sn(lw)
head(sn)
sn1 <- cbind(attr(sn, "region.id")[sn$from], attr(sn,
   "region.id")[sn$to])
head(sn1)

using the region.id attribute.

Hope this helps,

Roger