Description Usage Arguments Value Examples
Compute valid nearest neighbors of each valid point on a grid
1 | getNeighbors(mat, mask_fun = function(x) !is.na(x), verbose)
|
mat |
Matrix of gridpoints |
mask_fun |
Function that identifies valid observations For sparseMatrix where 0 denotes NA, use mask_fun = function(x) as.logical(x != 0) |
List with IDs of valid points (old and new) and list (ngb) of their neighbors
1 2 3 4 5 | mat = matrix(runif(6), 2, 3)
mat[2,2] = NA
getNeighbors(mat, verbose=F)
mat[2,2] = 0
getNeighbors(enforceM(mat), function(x) as.logical(x != 0), verbose=F)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.