tr | R Documentation |
Returns the sum of the diagonal elements of a matrix.
tr(X)
X |
A matrix whose diagonal elements will be added together. |
This returns the trace of a matrix, which is just the sum of its diagonal elements.
The sum of the diagonal elements of X.
Peter Hoff.
X <- matrix(1:4, nrow = 2, ncol = 2) X tr(X)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.