Changelog
Source:NEWS.md
nlmixr2targets 0.1.0.9000
New features
The final
<name>target oftar_nlmixr()now emitsfitUpdate(the restored labels and data) andassign(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()andtar_nlmixr_multimodel()now forwardformat,repository,library,memory,garbage_collection,deployment,storage,retrievalandcueto every target they generate, defaulting each exactly astargets::tar_target()does.resources, which is what lets a fit run on acrewcontroller, is taken as two arguments:resources_datafor the_data_simpletarget andresources_fitfor every other target, so the data can be prepared on a different controller from the one that fits the model. Both default totargets::tar_option_get("resources").?tar_nlmixrdocuments 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>_covariatestarget holding the sorted names of the covariates it reads, and the_data_simpletarget 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 acovariatesargument for this, and the newnlmixr_object_covariates()computes it. Upgrading re-runs each_data_simpletarget once; its value is unchanged, so cached fits are not re-run.tar_nlmixr_multimodel()estimation targets now announce themselves withModel description: <list name>before estimation starts, sotar_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 explicitobject = NULLas “not supplied”, like a missing argument, so it gives the documented “Supply exactly one ofobjectandcovariates” error instead of failing further in with a class complaint aboutobject.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 fromnlmixr_object_covariates()and the data simplification dropped it, leaving the estimation to stop withIOV variable 'OCC' is not present in the data. Every occasion grouping variable is now kept, so naming it intableControl(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 acrewworker on another machine or in a fresh container. The estimation (_fit_simple) target callednlmixr2_indirect()while declaring onlynlmixr2est, and failed withcould not find function "nlmixr2_indirect". The final target evaluated the model expression (e.g.pheno |> ini(...)) withoutnlmixr2est, soini()was not found. All four targets per model now loadnlmixr2targetsandnlmixr2est. The combined list target oftar_nlmixr_multimodel()loads no package; before, it inheritedtargets::tar_option_set(packages = ), which defaults to every package attached when_targets.Ris sourced, so on a worker missing any of them the pipeline failed at its last target, after every fit had already succeeded. A localtar_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.tablenow reaches estimation.tar_nlmixr()andtar_nlmixr_multimodel()accept atable(nlmixr2est::tableControl()) argument and used it to decide which data columns survive into the simplified dataset, but never passed it tonlmixr2est::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 leavetableat its default are unaffected and are not re-run; supplying any othertableControl()re-runs the fit, as a changedcontrolwould.tar_nlmixr_multimodel()again acceptsdata,control, andtablearguments that cannot be evaluated where the pipeline is defined – most importantlydata = <name of an upstream target>, which is the normal way to write a pipeline and which failed withobject '<target name>' not foundwhen_targets.Rwas sourced. The model-description feature above dispatched over the model list withmapply(), which splices itsMoreArgsvalues 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 bynlmixr2est::vaeCovariates(), honoring the search-relatedcontroloptions), 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_simpletargets 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 bytar_nlmixr()ortar_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 itsParametercolumn even though the labels were restored onfit$ui.nlmixr_object_complicate()now also rebuilds the label column on the cachedparFixed/parFixedDftables.tar_nlmixr_multimodel()no longer fails when a model function that declares compartment initial conditions withcmt(0) <- valueis both fit directly and piped throughini()/model()in the same call (e.g."myfit" = modalongside"myfit pipe" = mod |> ini(a <- 2)). Sharing the model function between entries previously left the piped entry’s command referencing the internalcmt(initial)form, which nlmixr2 rejects (#37).
New features
-
tar_nlmixr()andtar_nlmixr_multimodel()gain anerrorargument. With the defaulterror = "stop", a model that fails haltstargets::tar_make()exactly as before. Witherror = "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 classnlmixr2targetsError, 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_simplepattern. The new names align with the convention already used bytar_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.