Learn R Programming

configural (version 0.1.5)

vech: Vectorize a matrix

Description

cvec returns the column-wise vectorization of an input matrix (stacking the columns on one another). rvec returns the row-wise vectorization of an input matrix (concatenating the rows after each other). vech returns the column-wise half-vectorization of an input matrix (stacking the lower triangular elements of the matrix, including the diagonal). vechs returns the strict column-wise half-vectorization of an input matrix (stacking the lower triangular elements of the matrix, excluding the diagonal). All functions return the output as a vector.

Usage

vech(x)

vechs(x)

cvec(x)

rvec(x)

Value

A vector of values

Arguments

x

A matrix

Author

Based on functions from the the OpenMx package

Examples

Run this code
cvec(matrix(1:9, 3, 3))
rvec(matrix(1:9, 3, 3))
vech(matrix(1:9, 3, 3))
vechs(matrix(1:9, 3, 3))
vechs(matrix(1:12, 3, 4))

Run the code above in your browser using DataLab