Skip to contents

Registers the name an assignment operator like nlmixr2save's := is assigning to, which rxode2 uses when the model expression itself names nothing (an anonymous model function) and when the expression is a call without a rxModelName() method. It is not consumed when it is used, so one assignment can name every model it builds; the operator that set it clears it with rxModelNameLhs(NULL), which is what keeps the name from leaking into an unrelated later model.

Usage

rxModelNameLhs(value)

Arguments

value

when specified, a single non-empty character naming the model, or NULL to clear the name. When missing the current name is returned.

Value

the registered name, or NULL when there is none

See also

Author

Matthew L. Fidler

Examples


# an assignment operator registers the name it is assigning to before it
# forces the model, and clears it afterward:
#
# `:=` <- function(x, value) {
#   rxode2::rxModelNameLhs(as.character(substitute(x)))
#   on.exit(rxode2::rxModelNameLhs(NULL))
#   assign(as.character(substitute(x)), force(value), envir=parent.frame())
# }

rxModelNameLhs()
#> NULL

rxModelNameLhs("mod")

rxModelNameLhs()
#> [1] "mod"

rxModelNameLhs(NULL)