What Function to Use For Trace Matrix in R
<p>While there is a function used for Trace Matrix as seen below:</p>

<pre><code>sum(diag(matrix))
</code></pre>

<p>This may incorrectly give you a result if the matrix is not Square (i.e. an "n x n" size). Are there any other inbuilt functions for running "Trace" of a matrix?</p>