vec {lazy.mat} | R Documentation |
Vectorization of a matrix
vec(A, byrow = 0)
A |
A matrix or vector |
byrow |
= 1 to get the row-major vectorization |
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.
A column vector of the size nrow(A)*ncol(A) times 1
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]