Skip to contents

Creates a column or row vector from a numeric vector.

Usage

colVec(x)
rowVec(x)

Arguments

x

a numeric vector.

Details

colVec and rowVec transform a vector into a column and row vector, respectively. A column vector is a matrix object with one column, and a row vector is a matrix object with one row.

Examples

x = rnorm(5)
   
colVec(x)
#>            [,1]
#> [1,] -0.7303355
#> [2,]  0.3296128
#> [3,]  0.5553862
#> [4,]  0.4934692
#> [5,]  1.9424086
rowVec(x)                        
#>            [,1]      [,2]      [,3]      [,4]     [,5]
#> [1,] -0.7303355 0.3296128 0.5553862 0.4934692 1.942409