Similarly to upper.tri
and lower.tri
, returns a matrix of logical
s to identify the diagonal of a square matrix
non.diagonal(M, output = c("matrix.logical", "vector.values"))
M | square matrix. |
---|---|
output | choose to either return a matrix of logical values ( |
either return a matrix of logical values (TRUE
s, FALSE
s on the diagonal) or a vector of the subsetted values of the matrix.
#> [,1] [,2] [,3] [,4] #> [1,] FALSE TRUE TRUE TRUE #> [2,] TRUE FALSE TRUE TRUE #> [3,] TRUE TRUE FALSE TRUE #> [4,] TRUE TRUE TRUE FALSE