Skip to contents

Get any matrix diagonal

Usage

get_diagonal(m, x, dim = c("row", "col"), dir = c("up", "down"))

Arguments

m

A matrix

x

A row or column index corresponding to the chosen dim

dim

"row" or "col" to indicate where x should be applied

dir

Whether or not the diagonal goes "up" or "down"

Value

A vector of the diagonal