Description Usage Arguments Value
This returns the (sparse) Matrix giving the adjacency matrix of cells in layer
.
1 2 | layer_adjacency(layer, from = which(raster::values(!is.na(layer))),
to = from, directions = 4, normalize = FALSE)
|
layer |
A Raster* object. |
from |
The indices of the cells corresponding to rows in the output matrix. [default: non-NA cells] |
to |
The indices of the cells corresponding to columns in the output matrix. [default: same as |
directions |
the number of directions in which cells should be
connected: 4 (rook's case), 8 (queen's case), 16 (knight and
one-cell queen moves), or 'bishop' to connect cells with
one-cell diagonal moves. Or a neigborhood matrix (see |
normalize |
If |
A sparse Matrix M
, where M[i,j]
is equal to 1 if cell from[i]
is adjacent to to[j]
, and is 0 otherwise.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.