#' @title Identity Matrix
#' @description Produces an indentity matrix of a given size
#' @param n positive integer indicating the size
#' @export
#' @examples
#' # 3x3 identity matrix
#' identity_matrix(3)
identity_matrix <- function(n)
{
if (!is_positive_integer(n))
stop("\n'n' must be a positive integer")
# output
diag(1, n)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.