Verify that a value is a valid nlmixr2 compartment name
Usage
assertCompartmentName(x)
assertVariableName(x)
assertParameterValue(x)
assertExists(ui, x)
testExists(ui, x)Functions
assertVariableName(): Verify that a value is a valid nlmixr2 variable nameassertParameterValue(): Verify that a value is a valid nlmixr2 parameter valueassertExists(): Assert compartment/variable existstestExists(): Test compartment/variable exists
Examples
assertCompartmentName("central")
assertVariableName("cl")
assertParameterValue(0.5)
try(assertCompartmentName("1central")) # invalid name
#> Error in assertCompartmentName("1central") :
#> Assertion on '"1central"' failed: Must comply to pattern '^[.]*[a-zA-Z]+[a-zA-Z0-9._]*$'.
# \donttest{
mod <- function() {
ini({
tcl <- log(3)
tv <- log(30)
})
model({
cl <- exp(tcl)
v <- exp(tv)
d/dt(central) <- -cl / v * central
})
}
assertExists(mod, "central")
#>
#>
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
testExists(mod, "ka")
#>
#>
#> ℹ parameter labels from comments are typically ignored in non-interactive mode
#> ℹ Need to run with the source intact to parse comments
#> [1] FALSE
# }
