These functions coerce an object to a 2-dimensional array in the shape of a row or column vector, i.e. an array with dimensions c(1,d) or c(d,1) respectively, where d=length(x).

as.mRowVector(x, USE.NAMES = TRUE)

as.mColVector(x, USE.NAMES = TRUE)

Arguments

x

An object that can be passed to array().

USE.NAMES

If TRUE and x has only one non-singular dimension, its names are preserved.

Value

A row or column vector with the data from x.

Examples

x <- c(a=1, b=2, c=3)
as.mColVector(x)
#>   [,1]
#> a    1
#> b    2
#> c    3

y <- matrix(1:12, 3, 4)
as.mRowVector(y)
#>      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
#> [1,]    1    2    3    4    5    6    7    8    9    10    11    12