vec2m | R Documentation |
Stack a vector to form a matrix with repeating rows, with optional column names and transformation
vec2m(vv, nr = 1, trans = identity)
vv |
A vector which will become the row of a matrix |
nr |
Number of (identical) rows this matrix will contain |
trans |
An optional function that can take a matrix as its sole argument. Useful functions include 'as.data.frame()' 'as_tibble()' and 'as.table()' |
A matrix, unless the function specified in the 'trans' argument causes the output to be something else.
vec2m(1:10,5);
vec2m(1:10,5,tr=data.frame);
vec2m(setNames(1:12,month.name),3);
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.