tr | R Documentation |
Hardly worth coding, if it didn't appear in so many formulae in psychometrics, the trace of a (square) matrix is just the sum of the diagonal elements.
tr(m)
m |
A square matrix |
The tr function is used in various matrix operations and is the sum of the diagonal elements of a matrix.
The sum of the diagonal elements of a square matrix.
i.e. tr(m) <- sum(diag(m)).
m <- matrix(1:16,ncol=4)
m
tr(m)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.