Skip to contents

nlmixr2targets 0.1.0.9000

New features

  • The final <name> target of tar_nlmixr() now emits fitUpdate (the restored labels and data) and assign (the target name) on the rxode2 event bus when rxode2 has one, so loggers such as nlmixr2log store one run per model, named after the target. Nothing changes without a listener. When the project has an nlmixr2log configuration (nlmixr2log::nlmixr2logSaveConfig()), the estimation target loads nlmixr2log so that the fit is logged on any worker.

  • tar_nlmixr(), tar_nlmixr_raw() and tar_nlmixr_multimodel() now forward format, repository, library, memory, garbage_collection, deployment, storage, retrieval and cue to every target they generate, defaulting each exactly as targets::tar_target() does. resources, which is what lets a fit run on a crew controller, is taken as two arguments: resources_data for the _data_simple target and resources_fit for every other target, so the data can be prepared on a different controller from the one that fits the model. Both default to targets::tar_option_get("resources"). ?tar_nlmixr documents the arguments that are deliberately not forwarded, and the shared cache directory the model targets need when they run on a remote worker. Adding these does not change any estimation command, so cached fits are not re-run.

  • Each model now has a <name>_covariates target holding the sorted names of the covariates it reads, and the _data_simple target depends on that instead of on _object_simple. A model edit that leaves the covariates unchanged (a new initial value, a structural change) no longer rebuilds the simplified data, and the data target no longer reads the simplified-model cache, so it can run on a worker that does not share the targets store. nlmixr_data_simplify() gains a covariates argument for this, and the new nlmixr_object_covariates() computes it. Upgrading re-runs each _data_simple target once; its value is unchanged, so cached fits are not re-run.

  • tar_nlmixr_multimodel() estimation targets now announce themselves with Model description: <list name> before estimation starts, so tar_make() output identifies which model is running (the targets themselves are named after a hash of the model). Renaming a model does not invalidate its fit, and existing pipelines are not re-run by this change.

Bug fixes

  • nlmixr_data_simplify() now treats an explicit object = NULL as “not supplied”, like a missing argument, so it gives the documented “Supply exactly one of object and covariates” error instead of failing further in with a class complaint about object.

  • A model with an occasion-level random effect (eta ~ var | OCC) can now be fitted. The grouping variable is read from the data but is not a covariate, so it was absent from nlmixr_object_covariates() and the data simplification dropped it, leaving the estimation to stop with IOV variable 'OCC' is not present in the data. Every occasion grouping variable is now kept, so naming it in tableControl(keep=) is no longer needed as a workaround. A grouping variable that is missing from the data is now reported when the data is simplified, naming the column, rather than at estimation.

  • The generated targets now run on a worker that has attached nothing but the target’s own packages, such as a crew worker on another machine or in a fresh container. The estimation (_fit_simple) target called nlmixr2_indirect() while declaring only nlmixr2est, and failed with could not find function "nlmixr2_indirect". The final target evaluated the model expression (e.g. pheno |> ini(...)) without nlmixr2est, so ini() was not found. All four targets per model now load nlmixr2targets and nlmixr2est. The combined list target of tar_nlmixr_multimodel() loads no package; before, it inherited targets::tar_option_set(packages = ), which defaults to every package attached when _targets.R is sourced, so on a worker missing any of them the pipeline failed at its last target, after every fit had already succeeded. A local tar_make() hid the problem, because reading an upstream target’s value attaches that target’s packages. The generated commands are unchanged, so cached fits are not re-run.

  • table now reaches estimation. tar_nlmixr() and tar_nlmixr_multimodel() accept a table (nlmixr2est::tableControl()) argument and used it to decide which data columns survive into the simplified dataset, but never passed it to nlmixr2est::nlmixr(), so the residual/table step always ran with the defaults. tableControl(keep = ...) columns, for example, were kept in the data and then dropped from the fit. Pipelines that leave table at its default are unaffected and are not re-run; supplying any other tableControl() re-runs the fit, as a changed control would.

  • tar_nlmixr_multimodel() again accepts data, control, and table arguments that cannot be evaluated where the pipeline is defined – most importantly data = <name of an upstream target>, which is the normal way to write a pipeline and which failed with object '<target name>' not found when _targets.R was sourced. The model-description feature above dispatched over the model list with mapply(), which splices its MoreArgs values into a constructed call and evaluates them, so the captured expressions were evaluated during pipeline construction instead of reaching the target commands unevaluated.

  • Fits with est = "vae" are now cached correctly: the simplified dataset keeps the subject-constant columns that vae’s automated covariate selection searches (as reported by nlmixr2est::vaeCovariates(), honoring the search-related control options), not just the covariates named in the model. Previously those candidate columns were dropped, so the covariate search ran on a reduced candidate set and editing such a column did not invalidate the cached fit (#39). Existing _data_simple targets will re-run once after upgrading because their command changed; downstream fit targets only re-run if the simplified data actually change.

  • Parameter labels set with label() now show when printing a fit produced by tar_nlmixr() or tar_nlmixr_multimodel(). The labels are stripped before estimation (so that label-only edits do not invalidate the cached fit), and nlmixr2est bakes the printed parameter table at estimation time, so the final fit’s table lacked its Parameter column even though the labels were restored on fit$ui. nlmixr_object_complicate() now also rebuilds the label column on the cached parFixed/parFixedDf tables.

  • tar_nlmixr_multimodel() no longer fails when a model function that declares compartment initial conditions with cmt(0) <- value is both fit directly and piped through ini()/model() in the same call (e.g. "myfit" = mod alongside "myfit pipe" = mod |> ini(a <- 2)). Sharing the model function between entries previously left the piped entry’s command referencing the internal cmt(initial) form, which nlmixr2 rejects (#37).

New features

  • tar_nlmixr() and tar_nlmixr_multimodel() gain an error argument. With the default error = "stop", a model that fails halts targets::tar_make() exactly as before. With error = "continue", a failure in any step of that model’s chain – simplifying the object, reading its covariates, simplifying the data, or the estimation itself – is caught and the target stores a failure sentinel (an object of class nlmixr2targetsError, which also inherits from "try-error") carrying the error message. The sentinel is passed down the model’s remaining steps to its final target, so one failed model – including one whose structure the dataset cannot support, which fails before estimation – does not stop the rest of the pipeline (#35).

nlmixr2targets 0.1.0

CRAN release: 2026-06-05

Breaking changes from unreleased development version

  • tar_nlmixr() now produces intermediate targets named <name>_object_simple, <name>_data_simple, and <name>_fit_simple (single-underscore separator). Prior versions used the longer <name>_tar_object_simple/_tar_data_simple/_tar_fit_simple pattern. The new names align with the convention already used by tar_nlmixr_multimodel(). Users with cached pipelines from earlier versions will see one rebuild (the old targets become orphans); targets::tar_destroy() will remove them if desired.