evaluate_by_row: Evaluate a simulation function on each row of a data frame

Description Usage Arguments Value Examples

Description

Evaluates a simulation function on each row of a data frame containing parameter values, returns a single data frame with parameters and simulation results. The function uses furrr::future_pmap, which allows for easy parallelization.

Usage

1
2
evaluate_by_row(params, sim_function, ..., .progress = FALSE,
  .options = future_options(), system_time = TRUE)

Arguments

params

data frame of 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 params. The function must return a data.frame, tibble, or vector.

...

additional arguments passed to sim_function.

.progress

A logical, for whether or not to print a progress bar for multiprocess, multisession, and multicore plans.

.options

The future specific options to use with the workers. This must be the result from a call to future_options().

system_time

logical indicating whether to print computation time. TRUE by default.

Value

A data frame containing parameter values and simulation results.

Examples

1
2
3
4
5
6
df <- data.frame(
  n = 3:5,
  lambda = seq(8, 16, 4)
)

evaluate_by_row(df, rpois)

jepusto/Pusto documentation built on June 5, 2019, 9:51 p.m.