Assert a variable exists in the model
Value
variable that matches, in the case of multiple variables, the first that matches. If nothing matches return error
Examples
# \donttest{
mod <- function() {
ini({
tcl <- log(3)
tv <- log(30)
add.sd <- 0.7
})
model({
cl <- exp(tcl)
v <- exp(tv)
d/dt(central) <- -cl / v * central
cp <- central / v
cp ~ add(add.sd)
})
}
assertVariableExists(mod, "cp")
#>
#>
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
testVariableExists(mod, "kel")
#>
#>
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
#> [1] FALSE
# }
