View source: R/MxAlgebraFunctions.R
vec2diag | R Documentation |
Given an input row or column vector, vec2diag
returns a diagonal matrix with the input argument along the diagonal.
vec2diag(x)
x |
a row or column vector. |
Similar to the function diag
, except that the input argument is always
treated as a vector of elements to place along the diagonal.
diag2vec
vec2diag(matrix(1:4, 1, 4))
vec2diag(matrix(1:4, 4, 1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.