Return the 8 neighbors, as cell numbers, of each cell on a raster.
Usage
ngb8(n_row, n_col)
Arguments
n_row
Integer. The number of rows of a Raster or object.
n_col
Integer. The number of columns of a Raster object.
Value
Named list, the nth element of the list corresponds to the 8
adjacent cell numbers of the nth cell on the Raster* object.
Details
A cell with coordinates (x, y) has 8 neighbors with
coordinates: (x<U+00B1>1, y), (x, y<U+00B1>1) and (x<U+00B1>1, y<U+00B1>1). Cells
on the edge of a raster have less than 8 neighbors. The function identifies
the neighbors of a cell as cell numbers.