Learn R Programming

matricks (version 0.8.2)

neighbour_idx_matrix: 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

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab