grid_trace: Sum of the Diagonal

View source: R/GridProcessing.R

grid_traceR Documentation

Sum of the Diagonal

Description

Returns the sum of all cells on either a grid's main diagonal (trace) or its secondary diagonal.

Usage

grid_trace(mat, col = NULL, limesurvey = TRUE)

Arguments

mat

a square matrix.

col

the number of columns of the matrix.

limesurvey

logical. If FALSE the function calculates the sum of the diagonal from bottom-left to top-right.

Value

The sum of the matrix's diagonal, either from top-left to bottom-right (the default) or from bottom-left to top-right.


douglaswhitaker/GridItemTools documentation built on Aug. 2, 2022, 4:32 a.m.