Learn R Programming

fastmatrix (version 0.3-8)

vec: Vectorization of a matrix

Description

This function returns a vector obtained by stacking the columns of x

Usage

vec(x)

Arguments

x

a numeric matrix.

Value

Let x be a \(n\) by \(m\) matrix, then vec(x) is a \(nm\)-dimensional vector.

Examples

Run this code
# NOT RUN {
x <- matrix(rep(1:10, each = 10), ncol = 10)
x
y <- vec(x)
y
# }

Run the code above in your browser using DataLab