R/get_diagonal.R
get_diagonal.Rd
Get any matrix diagonal
get_diagonal(m, x, dim = c("row", "col"), dir = c("up", "down"))
A matrix
A row or column index corresponding to the chosen dim
dim
"row" or "col" to indicate where x should be applied
"row"
"col"
x
Whether or not the diagonal goes "up" or "down"
"up"
"down"
A vector of the diagonal