Learn R Programming

automultinomial (version 1.0.0)

adjMat: Spatial adjacency matrix

Description

Takes as input a matrix gridMat with the following format: 0 means a site is included in the study area, and nonzero values mean the site is not included. Returns an adjacency matrix for the study sites, where sites at a Manhattan distance of exactly kNN are considered neighbors.

Usage

adjMat(m, n, boundary = FALSE)

Arguments

m

height of the grid

n

width of the grid

boundary

surround grid by an external boundary, defaults to FALSE

Value

a list containing a sparse adjacency matrix for a square lattice, and the vector of the points not on the edge

Examples

Run this code
# NOT RUN {
mat=adjMat(10,10)
# }

Run the code above in your browser using DataLab