vec {lazy.mat}R Documentation

Vectorization of a matrix

Description

Vectorization of a matrix

Usage

vec(A, byrow = 0)

Arguments

A

A matrix or vector

byrow

= 1 to get the row-major vectorization

Details

When A is a vector it will be converted to a column vector.
Same as matrix(A,,1). The result is a column vector consisting of c(A).

vec(A, byrow=1) is equal to vec(t(A)).

Can be used with a character matrix.

Value

A column vector of the size nrow(A)*ncol(A) times 1

Examples

vecA=vec(demomat(3,2))
A=matrix(vecA,3)

vec(A,byrow=1)-vec(t(A))


# converting to a native vector with name
vecA=vecA[,1,drop=1]


[Package lazy.mat version 0.1.3 Index]