Learn R Programming

matlib (version 0.6.0)

vec: Vectorize a Matrix

Description

Returns a 1-column matrix, stacking the columns of x, a matrix or vector

Usage

vec(x)

Arguments

x
A matrix or vector

Value

  • A one-column matrix containing the elements of x in column order

Examples

Run this code
vec(1:3)
vec(matrix(1:6, 2, 3))
vec(c("hello", "world"))

Run the code above in your browser using DataLab