Skip to contents

Assert a variable would be new to the model

Usage

assertVariableNew(ui, x)

Arguments

ui

rxode2 ui model

x

would the variable x variable be new in the model

Value

nothing, but will error if x would not be new

Author

Matthew L. Fidler

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)
  })
}
assertVariableNew(mod, "kel")
#>  
#>  
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
try(assertVariableNew(mod, "cp")) # already in the model
#>  
#>  
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
#> Error : variable 'cp' is already in the model
# }