R/lower.triangle.R

Defines functions lower.triangle

Documented in lower.triangle

lower.triangle <- function( x )
{
###
### this function returns the lower triangular matrix portion of matrix x
###
### Parameters
### x = a numeric matrix
###
    if ( !is.square.matrix( x ) )
        stop( "argument x is not a square numeric matrix" )
    y <- x
    y[row(x) < col(y)] <- 0
    return( y )
}

Try the matrixcalc package in your browser

Any scripts or data that you put into this service are public.

matrixcalc documentation built on Sept. 15, 2022, 1:05 a.m.