get_surround: Get surrounding elements of an element in a matrix.
Description
This function extracts all surrounding elements of a specified element in a matrix and returns the result as a vector.
Usage
get_surround(data, index, type = "all")
Arguments
data
Matrix.
index
Index position of element. Input as a vector of row then column positions.
type
Takes values of "direct" and "all". "direct" returns only the elements directly in contact with the specified element, whereas "all" returns every surrounding element including diagonals. Defaults to "all".