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 _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo