vec2mat | R Documentation |
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.
vec2mat(x, colnames = NULL, rownames = NULL, horizontal = TRUE)
to_mat(x, colnames = NULL, rownames = NULL, horizontal = TRUE)
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: |
A matrix
x <- runif(5)
vec2mat(x)
vec2mat(x, horizontal=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.