I am working on Spatial correlation on the location of states of India. I have a problem with Moran.test command. In that, it has an object "listw". I have decided the weights as
1 if state i&j share their boundary
How can I convert this matrix in listw form?