This function checks if each habitat cell (specified by swfCat) in a matrix has a specific number of neighboring habitat cells within a given distance.

areThereLonelyOLD(matrix, NNeighbors, queensCase = TRUE, maxDistance = 5)

Arguments

matrix

A binary matrix to check.

NNeighbors

Exact number of neighbors to check for each habitat cell.

queensCase

If TRUE, checks all 8 directions for neighbors; if FALSE, checks only 4.

maxDistance

Maximum distance to look for neighbors.

Value

TRUE if any habitat cell has the specified number of neighbors within the given distance, FALSE otherwise.