Description Usage Arguments Details Value Examples
This function generates the code for a model object, prints it to the console or writes it to a file.
1 2 3 4 5 6 7 | render(
model,
filename = NULL,
target_tool = "nonmem",
tasks = tsk_estimation(),
options = assemblerr_options()
)
|
model |
A model object |
filename |
Name of the model file to create or NULL |
target_tool |
Name of the target tool (currently only 'nonmem') |
tasks |
A task specification |
options |
List of options for model generation |
The generated code will be written to the file specified by filename=
or printed to the console if the filename is
set to NULL
. Only 'nonmem'
is currently supported as a target_tool=
option. The tasks=
argument allows the
specification of model tasks and the options=
argument customizes the generated code.
Tasks are building blocks that allow to specify what a model should "do". Like other model building blocks, they can be combined using the +
operator.
For example, the following adds an estimation task and an xpose4 output task to the generated code:
1 2 | render(m, tasks = tsk_estimation() +
tsk_output_xpose4())
|
The default argument (tasks=tsk_estimation()
) adds an FOCE estimation task to the code.
The options=
argument allows to modify the rendering process and, hence, the generated code. Options are provided
as a list and the assemblerr_options()
function helps to generate list with the proper formatting.
The following code block renders the model m
with automatic mu-referencing for the model parameters
1 | render(m, options = assemblerr_options(prm.use_mu_referencing = TRUE))
|
The model code as a character vector
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | m <- model() +
input_variable("dose") +
prm_log_normal("emax") +
prm_log_normal("ed50") +
obs_additive(eff~emax*dose/(ed50+dose))
# render to console
render(m)
# render to file
## Not run:
setwd(tempdir())
render(m, "run1.mod")
## End(Not run)
# render to console with estimation & output task
render(m, tasks = tsk_estimation() + tsk_output_xpose4())
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.