By default, this compares a model's model file on disk to the model file of its "parent" model (the model referenced in its based_on field). It can optionally take a second model (passed to .mod2), in which case it will compare the first model to the second model, ignoring the based_on field entirely.

model_diff(.mod, .mod2 = NULL, .file = "model", ..., .viewer = FALSE)

# S3 method for bbi_nonmem_model
model_diff(.mod, .mod2 = NULL, .file = c("model"), ..., .viewer = FALSE)

# S3 method for bbi_nmboot_model
model_diff(.mod, .mod2 = NULL, .file = c("model"), ..., .viewer = FALSE)

# S3 method for bbi_nmsim_model
model_diff(.mod, .mod2 = NULL, .file = c("model"), ..., .viewer = FALSE)

Arguments

.mod

The bbi_{.model_type}_model to compare.

.mod2

If a bbi_{.model_type}_model object is passed, compare .mod to .mod2. If .mod2 = NULL, the default, compare .mod to the model at get_based_on(.mod). See "based_on details" in Details section.

.file

Defaults to "model" which compares the default model file for that model type. For NONMEM models, the control stream is compared. Other model types may accept additional values and support comparing multiple files. See ".file argument" of the specific S3 method for details.

...

arguments passed through to methods. (Currently none.)

.viewer

If FALSE, the default, prints diff to console or renders in Rmd. If TRUE, render the diff in the Viewer window. Note: this option will hold the console with Press ENTER to continue... so it is only recommended for interactive use.

Value

Returns a "Diff" object from the diffobj package that renders when printed or called in the console.

Details

Printing vs. knitting: When using this function in an .Rmd file that you intend to knit to HTML, be sure to set the chunk option results = "asis" for the relevant chunk. If you do this, the model_diff() output will render nicely in color in the HTML doc. Note this only works for HTML output. If you are are rendering to a different format (PDF, DOCX, etc.) you can still use model_diff() without results = "asis" and it will render, although it won't look particularly nice.

based_on details: As described above, if .mod2 is NULL (the default), then the .mod will be compared to the model returned by get_based_on(.mod). However, if there is more than one model (or no models) in .mod$based_on, then user will be prompted to explicitly pass the model they want to compare against to the .mod2 argument.