vec2mat {exams.forge} | R Documentation |
Vector to Matrix Conversion
Description
Converts a vector to a horizontal or vertical matrix and sets row-
or colnames
.
If rownames
or colnames
are given, then existing row names or column names are overwritten.
Usage
vec2mat(x, colnames = NULL, rownames = NULL, horizontal = TRUE)
to_mat(x, colnames = NULL, rownames = NULL, horizontal = TRUE)
Arguments
x |
vector |
colnames |
character: vector of new column names (default: |
rownames |
character: vector of new row names (default: |
horizontal |
logical: horizontal or vertical matrix (default: |
Value
A matrix
Examples
x <- runif(5)
vec2mat(x)
vec2mat(x, horizontal=FALSE)
[Package exams.forge version 1.0.10 Index]