Learn R Programming

lava (version 1.6.4)

tr: Trace operator

Description

Calculates the trace of a square matrix.

Usage

tr(x, ...)

Arguments

x

Square numeric matrix

Additional arguments to lower level functions

Value

numeric

See Also

crossprod, tcrossprod

Examples

Run this code
# NOT RUN {
tr(diag(1:5))
# }

Run the code above in your browser using DataLab