unroll | R Documentation |
Displays all values of a matrix of vectors by “unrolling” the object vertically or horizontally.
unroll(x, bycol = FALSE, drop = TRUE)
x |
a list of vectors with a |
bycol |
logical; whether to unroll horizontally
( |
drop |
logical; if |
unroll
returns a matrix where elements of x
are concatenated (“unrolled”) by row (bycol = FALSE
) or
by column (bycol = TRUE
). NA
is used to make
rows/columns of equal length.
Vectors and one dimensional arrays are coerced to row matrices.
A vector or matrix.
Vincent Goulet vincent.goulet@act.ulaval.ca and Louis-Philippe Pouliot
This function was originally written for use in
severity.portfolio
.
x <- list(c(1:3), c(1:8), c(1:4), c(1:3))
(mat <- matrix(x, 2, 2))
unroll(mat)
unroll(mat, bycol = TRUE)
unroll(mat[1, ])
unroll(mat[1, ], drop = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.