Learn R Programming

ramify (version 0.3.3)

tril: Extract Lower Triangular Matrix

Description

Extract the lower triangular part of a matrix.

Usage

tril(x, k = 0, diag = TRUE)

Arguments

x
A matrix.
k
Diagonal above which to zero elements. k = 0 (the default) is the main diagonal, k < 0 is below it and k > 0 is above.
diag
Logical indicating whether to include the diagonal. Default is TRUE.

Examples

Run this code
tril(ones(5, 5))
tril(ones(5, 5), diag = TRUE)

Run the code above in your browser using DataLab