[R-sig-Geo] Create listw or nb object from binary edge matrix
jcoyle
jrcoyle at live.unc.edu
Sat Feb 28 17:32:51 CET 2015
I am trying to create an nb or listw object for use with spdep functions from
a binary matrix with 1 indicating that two 'regions' are neighbors. However,
the following code does not produce a neighbors list as I think it should
after reading this previous post
<https://stat.ethz.ch/pipermail/r-sig-geo/2009-February/005070.html> :mat =
matrix(0, 4, 4)mat[1,2] = 1mat[2,1] = 1mat[3,4] = 1mat[4,3] = 1lw =
mat2listw(mat)lw$neighborsWhat am I doing wrong?Thanks!Jes
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Create-listw-or-nb-object-from-binary-edge-matrix-tp7587849.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo
mailing list