| adjPairsWithId | R Documentation |
Computes 4- or 8-direction neighbour pairs (from, to, id) for every cell and filters out neighbours that fall off the raster top/bottom or wrap across left/right edges. Rows are emitted in the same direction-major order that adj() produces (topl, top, topr, lef, rig, botl, bot, botr for directions == 8) so that downstream seeded operations (e.g. R-side sample.int shuffle) consume RNG state and produce identical output to the original spread2 implementation. This replaces only the adj() call inside the spread2 main loop; the row-randomization step still happens in R afterwards.
adjPairsWithId(cells, id, numCol, numCell, directions)
cells |
integer vector of source cell indices (1-based) |
id |
integer vector of the same length as cells; the event id for each cell |
numCol |
integer; number of raster columns |
numCell |
integer; total number of raster cells |
directions |
integer; either 4 or 8 |
A list with three integer vectors from, to, id.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.