matrixTriangle: Extract or replace the upper/lower triangular portion of a...

matrixTriangleR Documentation

Extract or replace the upper/lower triangular portion of a matrix.

Description

Extract or replace the upper/lower triangular portion of a matrix

Usage

upperTriangle(x, diag = FALSE, byrow = FALSE)

upperTriangle(x, diag = FALSE, byrow = FALSE) <- value

lowerTriangle(x, diag = FALSE, byrow = FALSE)

lowerTriangle(x, diag = FALSE, byrow = FALSE) <- value

Arguments

x

[matrix]

diag

[logical] If TRUE, include the matrix diagonal.

byrow

[logical] If FALSE, return/replace elements in column-wise order. If TRUE, return/replace elements in row-wise order.

value

Either a single value or a vector of length equal to that of the current upper/lower triangular. Should be of a mode which can be coerced to that of 'x'.

Details

Essentially a copy from the R package gdata, to limit the number of dependency in butils.

Examples

## see the documentation of gdata::upperTriangle

bozenne/butils documentation built on Oct. 14, 2023, 6:19 a.m.