Skip to contents

Writes the app's reproducible bundle (".zip": the model code, a standalone simulation.R script, the dosing events and, for a population, the covariates) for a simulation from mvp_simulate(). Give several simulations (e.g. two regimens or two models that were compared) to get one bundle for all of them: a folder per simulation with its own standalone bundle, a compare.R script that runs them and redraws the comparison (profiles, exposure table, percentage above a target), and a README that says how the simulations differ.

Usage

mvp_bundle(
  x,
  file,
  var = NULL,
  start = NULL,
  end = NULL,
  target = NULL,
  at = NULL
)

Arguments

x

An mvp_sim object from mvp_simulate(), or a named list of them (as for mvp_compare(); unnamed ones become "Model 1", "Model 2", ...).

file

Path of the .zip file to write (required; nothing is written by default).

var, start, end, target, at

Several simulations only: the comparison that compare.R redraws: the output (default: the first output), the exposure window (default: the whole simulation), a target value and the times at which to count subjects above it (default: the last sampling time).

Value

Invisibly, file.

Examples

# \donttest{
if (interactive()) {
  mod <- mvp_model("1cmt")
  sim <- mvp_simulate(mod, dose = mvp_dose(100), times = mvp_times(24))
  mvp_bundle(sim, file.path(tempdir(), "scenario.zip"))

  qd  <- mvp_simulate(mod, dose = mvp_dose(200, ii = 24, n = 7), times = mvp_times(168),
                      population = 50)
  bid <- mvp_simulate(mod, dose = mvp_dose(100, ii = 12, n = 14), times = mvp_times(168),
                      population = 50)
  mvp_bundle(list("200 mg QD" = qd, "100 mg BID" = bid), file.path(tempdir(), "comparison.zip"),
             start = 144, end = 168, target = 0.5)
}
# }