First import the campsismod
package. This step is not required if you have already loaded the campsis
package.
library(campsismod)
Load 2-compartment PK model from built-in model library and show content.
model <- model_suite$pk$`2cpt_fo` show(model)
A CAMPSIS model can be persisted on your local drive as follows:
model %>% write(file="path_to_model_folder") list.files("path_to_model_folder")
As shown, the output directory will contain the model (all code records) and 1 csv
file per type of parameter (THETA, OMEGA and SIGMA).
To read a CAMPSIS model from your local drive, use the read.campsis
function.
The exact same model should be retrieved.
model <- read.campsis(file="path_to_model_folder") show(model)
The MAIN
record is the part of the model where your model parameters are defined. The ODE
record is where your ordinary differential equations (ODE) go, as well as any equation depending on the simulation time. The ERROR
record is the place where the error model is defined. The model parameters are then shown, followed by the all the compartments.
campsismod
has powerful export capabilities to RxODE
and mrgsolve
, the 2 simulation engines supported by campsis
.
The following code exports the model to RxODE
. Please note that this step is implicit in CAMPSIS when you call the simulate
method with your preferred simulation engine.
rxmod <- model %>% export(dest="RxODE") rxmod
The following code exports the model to mrgsolve
(text form).
mrgmod <- model %>% export(dest="mrgsolve") mrgmod
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.