neighbour_idx_matrix {matricks}R Documentation

Create matrix of lists, where each one contains list of neighbour field coordinates

Description

Create matrix of lists, where each one contains list of neighbour field coordinates

Usage

neighbour_idx_matrix(mat, mask = NULL, diagonal = TRUE,
  random.select = NULL)

Arguments

mat

matrix

mask

logical matrix. Its dimensions must be identical with dimensions of mat

diagonal

logical. get diagonal neighbours

random.select

select one random neighbour

Examples

T <- TRUE; F <- FALSE
mat <- matrix(0, 3, 3)
mask <- m(T, T, F | T, F, T | F, F, T)
nimat <- neighbour_idx_matrix(mat, mask, diagonal = TRUE)
neighbour_idx_matrix(mat, mask, diagonal = TRUE, random.select = 1)

[Package matricks version 0.8.2 Index]