Copies previously executed model into a new object and optionally accept all estimates returned from model execution. A new working directory is created and all files from base model are copied into it.

copyModel(model, acceptAllEffects = FALSE, modelName = "", workingDir = "")



Model object to be copied


Set to TRUE to accept all effects, update PML statements, and test.mdl file from original model run


New model name for subdirectory created for model output. Subdirectory is created in current working directory.


Working directory to run the model. Current working directory will be used if workingDir not specified.


if (FALSE) {
# Create initial model
model <- pkmodel(
  parameterization = "Clearance",
  absorption = "Intravenous",
  numCompartments = 2,
  data = pkData,
  ID = "Subject",
  A1 = "Amount",
  CObs = "Conc",
  Time = "Act_Time",
  modelName = "pk_model"

# Fit Model
job <- fitmodel(model)

# Copy model and accept all effects from the original model run
vpcModel <- copyModel(model, acceptAllEffects = TRUE, modelName = "vpc_model")