Learn R Programming

matrixcalc (version 1.0-6)

vec: Vectorize a matrix

Description

This function returns a column vector that is a stack of the columns of x, an m by n matrix.

Usage

vec(x)

Value

A matrix with \(m\;n\) rows and one column.

Arguments

x

a matrix

Author

Frederick Novomestky fnovomes@poly.edu

References

Magnus, J. R. and H. Neudecker (1999) Matrix Differential Calculus with Applications in Statistics and Econometrics, Second Edition, John Wiley.

Examples

Run this code
x <- matrix( seq( 1, 16, 1 ), nrow=4, byrow=TRUE )
print( x )
vecx <- vec( x )
print( vecx )

Run the code above in your browser using DataLab