tr computes the trace of a matrix.
tr
tr(X)
a (square) matrix
the trace (a scalar)
# NOT RUN { X <- matrix(runif(25),ncol=5) print(X) print(tr(X)) # }
Run the code above in your browser using DataLab