Diag | R Documentation |
Like the base diag
function, except that vectors of length
one are converted to 1-by-1 matrices, values can be specified either as a
single vector argument or multiple arguments, and row and column names can
be specified.
Diag(x, ..., .names = names(x), .colnames = .names, .rownames = .names)
x |
A numeric (or number-like) vector (possibly named). |
... |
Additional numeric (or number-like) vectors (possibly named). |
.names , .colnames , .rownames |
Optionally, specify the row and column names of the resulting diagonal matrix. |
Diag(6)
Diag(3.14, .names="pi")
Diag(1:6, .colnames=LETTERS[1:6], .rownames=letters[1:6])
Diag(1, 2, 3)
Diag(a=1, b=2, c=3)
Diag(a=1, c(b=2, c=3))
Diag(2+3i, 4+5i)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.