Compiles one of the built-in templates, your own mrgsolve code, or a model file, as the app's "Generate Model" button does.
Usage
mvp_model(
template = NULL,
code = NULL,
file = NULL,
params = NULL,
ext_file = NULL,
quiet = TRUE
)Arguments
- template
A template id or name from
mvp_templates(), e.g."2cmt".- code
mrgsolve model code (a single string).
- file
Path to a model file: an mrgsolve
.cpp(or.mod/text) file, code saved from the app's editor, or a NONMEM control stream. A NONMEM model is translated with 'nonmem2mrgsolve' when its.extfile is next to it (or given asext_file) and the package is installed; otherwise usemvp_translate()(AI translation).- params
Optional named list of parameter values, e.g.
list(CL = 3, VC = 10). Names must be parameters of the model (seemvp_params()).- ext_file
For a NONMEM
file: its.extfile, if not next to it.- quiet
If
FALSE, show mrgsolve's build messages.
Details
Give exactly one of template, code or file. Compiling needs a
C++ compiler (Rtools on Windows) and takes a few seconds. Each compiled
model gets a unique name, so several models can be used side by side; a
template is compiled once per R session and then reused. If
the code does not compile, the error message holds the compiler's errors
(also in the condition's details, class mvp_compile_error).
Examples
# \donttest{
if (interactive()) {
mod <- mvp_model("2cmt", params = list(CL = 3, VC = 10))
mvp_params(mod)
}
# }