knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/"
)

campsismod

R-CMD-check Codecov test coverage CRAN version CRAN total downloads CRAN total downloads

EXPORT_PNG <- FALSE

Installation

Install the latest stable release using devtools:

devtools::install_github("Calvagone/campsismod")

Basic examples

Load example from model library

Load 2-compartment PK model from built-in model library:

library(campsismod)
model <- model_suite$pk$`2cpt_fo`

Write CAMPSIS model

model %>% write(file="path_to_model_folder")
list.files("path_to_model_folder")

Read and show CAMPSIS model

model <- read.campsis(file="path_to_model_folder")
show(model)

Simulate with rxode2 or mrgsolve

library(campsis)

dataset <- Dataset(5) %>%
  add(Bolus(time=0, amount=1000, ii=12, addl=2)) %>%
  add(Observations(times=0:36))

rxode <- model %>% simulate(dataset=dataset, dest="rxode2", seed=0)
mrgsolve <- model %>% simulate(dataset=dataset, dest="mrgsolve", seed=0)
spaghettiPlot(rxode, "CONC")
file_vignette <- "vignettes/resources/results_rxode.png"
ggplot2::ggsave(filename=file_vignette, width=7, height=3, dpi=100)
file.copy(file_vignette, "docs/articles/resources/")

rxode2 simulation results

spaghettiPlot(mrgsolve, "CONC")
file_vignette <- "vignettes/resources/results_mrgsolve.png"
ggplot2::ggsave(filename=file_vignette, width=7, height=3, dpi=100)
file.copy(file_vignette, "docs/articles/resources/")

mrgsolve simulation results



Calvagone/campsismod documentation built on June 2, 2025, 1:11 a.m.