#' Extract off-diagonals of square matrix.
#'
#' Returns vector of length n^2 - n, where n
#' @param x square matrix
#'
#' @keywords matrix
#'
#' @return vector of off-diagonal elements
#' @export
offdiags <- function(x) {
stopifnot(is_square_mat(x))
x[row(x) != col(x)]
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.