Creates new model object by specifying relevant information as arguments. Also creates necessary YAML file for using functions like add_tags() and run_log() later. Will look for an associated model file (control stream) on disk and warn if it doesn't find one.

new_model(
  .yaml_path,
  .description,
  .model_path = NULL,
  .based_on = NULL,
  .tags = NULL,
  .bbi_args = NULL,
  .model_type = c("nonmem"),
  .directory = get_model_directory()
)

Arguments

.yaml_path

Path to save resulting model YAML file to. MUST be either an absolute path, or a path relative to the .directory argument.

.description

Description of new model run. This will be stored in the yaml (and can be viewed later in run_log()). By convention, it should match the $PROBLEM statement in the control stream, but this is not enforced.

.model_path

Path to model (control stream) file. MUST be an absolute path, or the model path relative to the location of the YAML file. It recommended for the control stream and YAML to be in the same directory. If nothing is passed, the function will look for a file with the same path/name as your YAML, but with either .ctl or .mod extension.

.based_on

Character scalar or vector of paths 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.

.tags

A character scalar or vector with any user tags to be added to the YAML file

.bbi_args

A named list specifying arguments to pass to babylon formatted like list("nm_version" = "nm74gf_nmfe", "json" = T, "threads" = 4). Run print_nonmem_args() to see valid arguments. These will be written into YAML file.

.model_type

Character scalar to specify type of model being created (used for S3 class). Currently only 'nonmem' is supported.

.directory

Model directory which .yaml_path is relative to. Defaults to options('rbabylon.model_directory'), which can be set globally with set_model_directory().

Value

S3 object of class bbi_{.model_type}_model that can be passed to submit_model(), model_summary(), etc.