[R-sig-Geo] Clarification on Neighbours list

Ronnie Babigumira rb.glists at gmail.com
Thu Jan 5 15:05:31 CET 2006


Someone has pointed out that my question was not clear. With a clear danger of sounding really stupid, I will try to clarify

Say I have a polygon, which I convert to raster format so each cell is n by n. For some reason I select a set of cells 
and have a neat rectangle such as below. To get a neighbor list for such a grid I could use cell2nb(3, 8) would be fine

1 1 1 0 0 1 0 1
0 1 1 0 1 1 1 0
1 1 0 0 1 1 1 1

However say my grid came from the full map and looked something like this
   0 1 0 0 1
0 1 1 0 1 1 1
     0 0 1 1 1
       0 0 1 0 1
   1 1 0 1 1 1
   1 0 0 1
1 1 1 0 0
0 1 1

The number of rows is clear, however, what is the number of columns (and anyway, what R function do you use to get the 
dimensions of a SpatialGridDataFrame object.


Ronnie




More information about the R-sig-Geo mailing list