Description Usage Arguments Value Examples
A convenience function used to arrange vectorised matrix samples into the correct
matrix format for several functions used to specify Markov model. See example_two_state_markov
for an example use case. Implemented using Rcpp.
1 | MatrixArrange(samples)
|
samples |
A list of vectorised matrix samples |
A list of matrices with each matrix representing a single sample.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | matrix_samples <- list(VGAM::rdiric(1:5, c(88, 12)),
VGAM::rdiric(1:5, c(8, 92)))
# R implementation
samples_r <- matrix_arrange_inner(matrix_samples)
# Rcpp implementation
samples_rcpp <- MatrixArrange(matrix_samples)
all.equal(samples_r, samples_rcpp)
# Benchmark
library(microbenchmark)
microbenchmark(matrix_arrange_inner(matrix_samples),
MatrixArrange(matrix_samples),
times = 1000)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.