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

gsidiagExtract

Internal functions: Get the diagonal of a matrix


Description

Get the main diagonal of a matrix, even if the matrix is 1x1.

Usage

gsi.diagExtract(x)

Arguments

x

a matrix

Details

The difference to original diag is that it always gives the diagonal and does nothing flawed in case of a 1x1 matrix or a single number considered as such matrix.

Value

a vector containing the main diagonal entries of x.

Note

Do not use gsi.* functions directly since they are internal functions of the package

Author(s)

K.Gerald v.d. Boogaart http://www.stat.boogaart.de

See Also

Examples

#data(SimulatedAmounts)
#gsi.diagExtract(var(acomp(sa.lognormals,c(1,2))))
#gsi.diagExtract(var(ilr(acomp(sa.lognormals,c(1,2)))))
#gsi.diagExtract(var(ilt(aplus(sa.lognormals,c(1)))))

compositions

Compositional Data Analysis

v2.0-1
GPL (>= 2)
Authors
K. Gerald van den Boogaart <boogaart@hzdr.de>, Raimon Tolosana-Delgado, Matevz Bren
Initial release
2021-01-08

We don't support your browser anymore

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