copy_model_from_impl: Copy model from an existing model

View source: R/copy-model-from.R

copy_model_from_implR Documentation

Copy model from an existing model

Description

Private implementation function called by copy_model_from() dispatches. Create new .yaml and other necessary files based on a previous model. Used for iterating on model development. Also fills in necessary YAML fields for using run_log() later.

Usage

copy_model_from_impl(
  .parent_mod,
  .new_model,
  .description = NULL,
  .based_on_additional = NULL,
  .add_tags = NULL,
  .star = NULL,
  .inherit_tags = FALSE,
  .update_model_file = TRUE,
  .overwrite = FALSE,
  setup_fn = NULL
)

Arguments

.parent_mod

S3 object of class ⁠bbi_{.model_type}_model⁠ to be used as the basis for copy.

.new_model

Path to the new model, either absolute or relative to the path to .parent_mod. Represents an absolute model path, which is the path to the YAML file and model file, both without extension, and the output directory (once the model is run). Numeric values will be coerced to character. If NULL, the default, will try to increment to the next integer in the destination directory. See examples for usage.

.description

Character scalar description of new model run. This will be stored in the yaml (and can be viewed later in run_log()).

.based_on_additional

Character vector of path(s) to other models that this model was "based on." These are used to reconstuct model developement and ancestry. Paths must be relative to .new_model path. Note that the .parent_model will automatically be added to the based_on field, so no need to include that here.

.add_tags

Character vector with any new tags(s) to be added to ⁠{.new_model}.yaml⁠

.star

Boolean, marks model to indicate special interest level.

.inherit_tags

If FALSE, the default, new model will only have any tags passed to .add_tags argument. If TRUE inherit any tags from .parent_mod, with any tags passed to .add_tags appended.

.update_model_file

Only relevant for NONMEM models. If TRUE, the default, update the ⁠$PROBLEM⁠ line in the new control stream. If FALSE, ⁠{.new_model}.[mod|ctl]⁠ will be an exact copy of its parent control stream.

.overwrite

If FALSE, the default, function will error if a model file already exists at specified .new_model path. If TRUE any existing file at .new_model will be overwritten silently.

setup_fn

A function to call (with no arguments) before creating the model with new_model().

Value

S3 object with the same class as .parent_mod


metrumresearchgroup/rbabylon documentation built on April 21, 2024, 3:26 a.m.