R/lower.R

Defines functions lower

Documented in lower

lower <- function(m)
{
# Takes the lower triangle of a matrix
# Does NOT check for symmetric matrix

m <- as.matrix(m)

if(ncol(m) != nrow(m))
    stop("Matrix not square.")
if(ncol(m) == 1) {
   warning("Matrix is 1x1.")
   m
}
else 
    m[col(m) < row(m)]
}
phiala/ecodist documentation built on Nov. 5, 2023, 10:47 a.m.