evaluate_by_row {simhelpers} | R Documentation |
Evaluate a simulation function on each row of a data frame or tibble
Description
Evaluates a simulation function on each row of a data frame or tibble
containing parameter values. Returns a single tibble with parameters
and simulation results. The function uses furrr::future_pmap
, which
allows for easy parallelization.
Usage
evaluate_by_row(
params,
sim_function,
...,
results_name = ".results",
.progress = FALSE,
.options = furrr::furrr_options(),
system_time = TRUE
)
Arguments
params |
data frame or tibble containing simulation parameter values. Each row should represent a separate set of parameter values. |
sim_function |
function to be evaluated, with argument names matching
the variable names in |
... |
additional arguments passed to |
results_name |
character string to set the name of the column storing the results of the simulation. Default is |
.progress |
A single logical. Should a progress bar be displayed? Only works with multisession, multicore, and multiprocess futures. Note that if a multicore/multisession future falls back to sequential, then a progress bar will not be displayed. Warning: The |
.options |
The |
system_time |
logical indicating whether to print computation time.
|
Value
A tibble containing parameter values and simulation results.
Examples
df <- data.frame(
n = 3:5,
lambda = seq(8, 16, 4)
)
evaluate_by_row(df, rpois)