Learn R Programming

caracas (version 2.0.0)

as_diag: Construct diagonal matrix from vector

Description

Construct diagonal matrix from vector

Usage

as_diag(x)

Arguments

x

Matrix with 1 row or 1 column that is the diagonal in a new diagonal matrix

Examples

Run this code
if (has_sympy()) {
  d <- as_sym(c("a", "b", "c"))
  D <- as_diag(d)
  D
}

Run the code above in your browser using DataLab