Extracts the diagonal elements from a 2-D array.
Arguments
- x
(
arrayish)
One input, with exactly 2 axes. Can be any data type. An R value materializes at its default data type.
Value
(arrayish)
Has the input's data type, and one axis of length min(nrow, ncol)
holding the diagonal elements.
See also
nv_diag() for creating a diagonal matrix, nv_trace()