Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

diag.ind

Diagonal Indices of a Matrix


Description

Returns a matrix of logicals the same size of a given matrix with entries 'TRUE' in the upper triangle close to the diagonal.

Usage

diag.ind(x, n = 1, diag = TRUE)

Arguments

x

a matrix.

n

the number of elements from the diagonal to include.

diag

logical. Should the diagonal be included?

Details

Basic function useful for masking elements close to the diagonal of a given matrix.

Value

Returns a matrix of logicals the same size of a given matrix with entries 'TRUE' in the upper triangle close to the diagonal.

Author(s)

Barry Grant

References

Grant, B.J. et al. (2006) Bioinformatics 22, 2695–2696.

See Also

Examples

diag.ind( matrix(,ncol=5,nrow=5), n=3 )

bio3d

Biological Structure Analysis

v2.4-2
GPL (>= 2)
Authors
Barry Grant [aut, cre], Xin-Qiu Yao [aut], Lars Skjaerven [aut], Julien Ide [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.