vec2diag: Create Diagonal Matrix From Vector

View source: R/MxAlgebraFunctions.R

vec2diagR Documentation

Create Diagonal Matrix From Vector

Description

Given an input row or column vector, vec2diag returns a diagonal matrix with the input argument along the diagonal.

Usage

vec2diag(x)

Arguments

x

a row or column vector.

Details

Similar to the function diag, except that the input argument is always treated as a vector of elements to place along the diagonal.

See Also

diag2vec

Examples


vec2diag(matrix(1:4, 1, 4))
vec2diag(matrix(1:4, 4, 1))



OpenMx documentation built on Oct. 19, 2024, 9:06 a.m.