findLinearNeighbours {flacco} | R Documentation |
Find Neighbouring Cells
Description
Given a vector of cell IDs (cell.ids
) and a vector (blocks
),
which defines the number of blocks / cells per dimension, a list of all
combinations of (linearly) neighbouring cells around each element of
cell.ids
is returned.
Usage
findLinearNeighbours(cell.ids, blocks, diag = FALSE)
Arguments
cell.ids |
[ |
blocks |
[ |
diag |
[ |
Value
[list
of integer(3)
].
List of neighbours. Each list element stands for a combination of
predecessing, current and succeeding cell.
Examples
cell.ids = c(5, 84, 17, 23)
blocks = c(5, 4, 7)
# (1) Considering diagonal neighbours as well:
findLinearNeighbours(cell.ids = cell.ids, blocks = blocks, diag = TRUE)
# (2) Only consider neighbours which are parellel to the axes:
findLinearNeighbours(cell.ids = cell.ids, blocks = blocks)