Verify that the compartment exists in a model
Value
the value of the compartment that exists; if it is a vector returns the first item that matches
Examples
# \donttest{
mod <- function() {
ini({
tka <- log(1.1)
tcl <- log(3)
tv <- log(30)
})
model({
ka <- exp(tka)
cl <- exp(tcl)
v <- exp(tv)
d/dt(depot) <- -ka * depot
d/dt(central) <- ka * depot - cl / v * central
})
}
# returns the first compartment that exists
assertCompartmentExists(mod, c("gut", "depot"))
#>
#>
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
testCompartmentExists(mod, "gut")
#>
#>
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
#> [1] FALSE
# }
