unroll {actuar} | R Documentation |
Display a Two-Dimension Version of a Matrix of Vectors
Description
Displays all values of a matrix of vectors by “unrolling” the object vertically or horizontally.
Usage
unroll(x, bycol = FALSE, drop = TRUE)
Arguments
x |
a list of vectors with a |
bycol |
logical; whether to unroll horizontally
( |
drop |
logical; if |
Details
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.
Value
A vector or matrix.
Author(s)
Vincent Goulet vincent.goulet@act.ulaval.ca and Louis-Philippe Pouliot
See Also
This function was originally written for use in
severity.portfolio
.
Examples
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)
[Package actuar version 3.3-4 Index]