as_array3 | R Documentation |
Convert a 2-dimensional tabular object where each row stores a flattened square matrix to a 3-dimensional array of square matrices and vice versa. This allows multiple transition matrices to be stored as either tabular objects (e.g., matrices, data frames, etc) or as arrays.
as_array3(x) as_tbl2( x, output = c("data.table", "data.frame", "matrix", "tpmatrix"), prefix = "", sep = "_" )
x |
For |
output |
The class of the object returned by the function. Either
a |
prefix, sep |
Arguments passed to |
For as_array3()
a 3-dimensional array of square matrices;
for as_tbl2()
a 2-dimensional tabular object as specified by output
.
tpmatrix
p_12 <- c(.7, .6) pmat <- tpmatrix( C, p_12, 0, 1 ) pmat as_array3(pmat) as_array3(as.matrix(pmat)) as_tbl2(as_array3(pmat)) as_tbl2(as_array3(pmat), prefix = "p_", sep = ".")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.