Changelog
Source:NEWS.md
nlmixr2targets 0.1.0.9000
Breaking changes
-
nlmixr_object_simplify()now returns the simplifiednlmixruiobject rather than an md5 hash, and the object travels between targets as an ordinary target value. The indirect cache under<targets store>/user/nlmixr2is gone, along with thedirectoryarguments ofnlmixr_object_simplify(),nlmixr_object_covariates(),nlmixr_data_simplify()andnlmixr_fit_simple(), and thenlmixr2targets_cache_status()andnlmixr2targets_cache_prune()functions. Delete that directory by hand to reclaim the space.nlmixr_object_covariates()andnlmixr_data_simplify()no longer accept a character md5 forobject; pass the simplified object.Building on a store an earlier version wrote now stops with an error that names the cache directory, because
targetswould otherwise re-run every fit: the_object_simpletarget’s value changes from a string to an object, and the generated commands no longer carrydirectory, so both hashestargetscompares change. To keep the fits already in the store, run the conversion script once before building:source(system.file( "scripts", "convert-indirect-cache.R", package = "nlmixr2targets" ))It rebuilds the cheap generated targets, which take seconds, and rewrites each estimation target’s recorded command and dependency hashes to the ones this version produces, so the fits are up to date rather than re-run. The fit objects are never read, written or recomputed, a timestamped copy of the metadata is made first, and the cache directory is removed last. Run it with
Rscriptand--dry-runto see what it would do without changing anything. It needs thesecretbasepackage, which ships withtargets.To accept re-running the fits instead, delete the cache directory. To build over it and leave it in place, set
options(nlmixr2targets.allow_indirect_cache = TRUE).What the cache bought was a dependency hash for the fit that tracked the model’s content rather than the rxUi’s internals. Edits to labels and metadata are still insulated, because the simplified object strips them and no longer carries the model function. Anything else inside an rxUi is not: a change there now invalidates the fits that depend on it, and because an rxUi does not serialize identically across platforms, so does rebuilding an
_object_simpletarget on a different platform from the one that built it last. What the cache cost was a file on one machine’s disk, which a pipeline whose workers run on other machines cannot read back – the reason for this change. nlmixr2_indirect()is renamednlmixr_fit_simple(): nothing is indirect about it now, and the new name matches the_fit_simpletarget it is the command for, and thenlmixr_*family it belongs to.The simplified object no longer carries the model function it was built from. Nothing read it –
$modelis derived, and estimation works without it – and it held thelabel()calls, so keeping it would have made a label-only edit change the object.
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. 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_object_simplify()now clearsrxModelVars$timeId, the wall-clock time of the model’s first translation in an R session; alinCmt()model’s second set of model vars (mvL) is cleared too. The same model simplified in two sessions previously gave objects that serialized to different bytes, sotargetssaw the_object_simpletarget change on every rebuild and re-ran every fit below it. The model’s content hash (ui$md5) is unaffected. The clearing is conditional on the field being present, so it stays correct when a later rxode2 stops storing it.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 callednlmixr_fit_simple()while declaring onlynlmixr2est, and failed withcould not find function "nlmixr_fit_simple". 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.