vech: Vectorize a matrix

Description Usage Arguments Value Author(s) Examples

View source: R/utility.R

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

1
2
3
4
5
6
7
vech(x)

vechs(x)

cvec(x)

rvec(x)

Arguments

x

A matrix

Value

A vector of values

Author(s)

Based on functions from the the OpenMx package

Examples

1
2
3
4
5
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))

Example output

-----------------------------------------------------  configural version 0.1.1  --

Please report any bugs to github.com/bwiernik/configural/issues
or brenton@wiernik.org

We work hard to produce these open-source tools for the R community, 
please cite configural when you use it in your research: 
  Wiernik, B. M. (2019). 
  configural: An R package for profile analysis [R package].
  https://github.org/bwiernik/configural

  Wiernik, B. M., Wilmot, M. P., Davison, M. L., & Ones, D. S. (2019). 
  Meta-analytic criterion profile analysis. 
  Manuscript submitted for publication.

Find info about configural on the web at wiernik.org
[1] 1 2 3 4 5 6 7 8 9
[1] 1 4 7 2 5 8 3 6 9
[1] 1 2 3 5 6 9
[1] 2 3 6
[1] 2 3 6

configural documentation built on Jan. 19, 2021, 1:06 a.m.