Returns the upper triangular part of a 2-D array, setting elements below the specified diagonal to zero.
Arguments
- x
(
arrayish)
One input, with exactly 2 axes. Can be any data type. An R value materializes at its default data type.- diagonal
(
integer(1))
Diagonal offset: the kept region iscol - row >= diagonal.0(default) keeps the main diagonal and everything above it, a negative value keeps that many diagonals below it as well, and a positive one drops the main diagonal anddiagonal - 1above it.
Value
(arrayish)
Has the same shape and data type as x.