Skip to contents

This function is typically not needed by end users.

Usage

nlmixr_object_simplify(object)

Arguments

object

Fitted object or function specifying the model.

Value

The MD5 hash used to load the simplified nlmixrui object back from the nlmixr2targets indirect cache.

Details

The object simplification removes comments (so please use label() instead of comments to label parameters) and then converts the object to a "nlmixrui" object.

Object metadata (ui$meta) and parameter labels (ui$iniDf$label) are also stripped from the simplified object before it is written to the indirect cache. They do not affect estimation, and stripping them keeps the cache hash stable across edits to either, so editing only labels or metadata will not invalidate the cached fit. The stripped values are restored on the final fit by nlmixr_object_complicate(), which reads them straight back off the original model.

The natural nlmixr2 DSL form for compartment initial conditions (cmt(0) <- value inside a model({...}) block) trips targets' static analysis because codetools::findGlobals() interprets it as a replacement-function assignment with a non-symbol target. tar_nlmixr() auto-rewrites cmt(0) <- value to cmt(initial) <- value inside model({...}) blocks at construction time (mutating the user's model function in env), and converts back to cmt(0) <- value before nlmixr2 sees the model. The user can therefore write cmt(0) <- value directly. Manual cmt(initial) <- value is also still accepted. Note: because the rewrite mutates the function in env, calling the model function directly (outside tar_make()) after tar_nlmixr() will see cmt(initial) in its body.

The simplified model's model.name is always set to "object". This keeps the simplified output stable so that the MD5 hash used by the targets indirect cache is independent of the symbol the caller bound the model function to.

See also

nlmixr_object_complicate() for the inverse operation that re-attaches labels, metadata, and the original data on the final fit.

Other Simplifiers: nlmixr_data_simplify(), nlmixr_object_complicate()