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)]
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.