vec: Vectorization of a matrix

View source: R/utils.R

vecR Documentation

Vectorization of a matrix

Description

This function returns a vector obtained by stacking the columns of \bold{X}.

Usage

  vec(x)

Arguments

x

a numeric matrix.

Value

Let \bold{X} be a n by m matrix, then vec(\bold{X}) is a nm-dimensional vector.

Examples

x <- matrix(rep(1:10, each = 10), ncol = 10)
x
y <- vec(x)
y

fastmatrix documentation built on Oct. 12, 2023, 5:14 p.m.

Related to vec in fastmatrix...