tidy_mc_latex | R Documentation |
Create a 'LaTeX' table containing the
summarized results of a Monte Carlo simulation run
by future_mc()
and summarized by summary.mc()
.
tidy_mc_latex(
x,
repetitions_set = NULL,
which_setup = NULL,
parameter_comb = NULL,
which_out = NULL,
kable_options = NULL
)
x |
An object of class |
repetitions_set |
A vector of integers specifying
at which repetitions the summarized
results should be displayed in the table.
Default: The argument |
which_setup |
A character vector containing the |
parameter_comb |
Alternative to |
which_out |
A character vector containing
the names of (some of) the named outputs
(the names of the returned list of |
kable_options |
A list whose components are named
after possible parameters
of |
Only one of the arguments which_setup
and parameter_comb
can be specified at one time.
Only (output - parameter combination)-pairs
for which the summary function specified
in the sum_funs
argument of summary.mc()
returns a single scalar value appear as
non-NA
values in the 'LaTeX' table.
If a specific output is summarized with functions
that do not return a single numeric value over all parameter combinations,
then this output is discarded from the table.
Similarly, if for a specific parameter combination all fun
outputs are
summarized with functions which do not return a single numeric value,
then this parameter combination is discarded as well.
In summary, all outputs must be summarized with functions
which return just one numeric value.
An object of class knitr_kable
which can be modified by the functions
in the kableExtra package is returned.
test_func <- function(param = 0.1, n = 100, x1 = 1, x2 = 2) {
data <- rnorm(n, mean = param) + x1 + x2
stat <- mean(data)
stat_2 <- var(data)
if (x2 == 5) {
stop("x2 can't be 5!")
}
return(list(mean = stat, var = stat_2))
}
param_list <- list(
param = seq(from = 0, to = 1, by = 0.5),
x1 = 1:2
)
test_mc <- future_mc(
fun = test_func,
repetitions = 1000,
param_list = param_list,
n = 10,
x2 = 2
)
tidy_mc_latex(summary(test_mc))
set.seed(101)
tidy_mc_latex(
summary(test_mc),
repetitions_set = c(10, 1000),
which_out = "mean",
kable_options = list(caption = "Mean MCS results")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.