| apply_batch | R Documentation |
Apply a function across simulation results
apply_batch(inputs, fun, ..., id = "batch_id")
inputs |
List with at least one element, commonly data frames or
simulation results. Element names label the batches; when |
fun |
Function applied to each element. When |
... |
Arguments passed to |
id |
Single string naming the batch-label column, default
|
A base data.frame stacking the fun outputs by row, with the
batch label in a leading column named by id, so one row per row of each
output.
inputs <- list(
small = simulate_ttest(n_a = 20, n_b = 20, mean_a = 0, mean_b = 0.5, seed = 1),
large = simulate_ttest(n_a = 60, n_b = 60, mean_a = 0, mean_b = 0.5, seed = 2)
)
apply_batch(inputs, fun = summary)
# A model function is applied to each data set and tidied to coefficients.
datasets <- simulate_regression(seed = 1, batch = 3)
apply_batch(datasets, lm, formula = outcome ~ x1 + x2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.