Skip to contents

This function is typically not needed by end users. It is the command of the _covariates target generated by tar_nlmixr(), whose value is what nlmixr_data_simplify() keeps beyond the standard event columns.

Usage

nlmixr_object_covariates(
  object,
  directory = file.path(targets::tar_config_get("store"), "user/nlmixr2"),
  error = c("stop", "continue")
)

Arguments

object

Either an nlmixr ui object (e.g. the output of running nlmixr(object = model)) or a character md5 hash identifying a simplified ui in the nlmixr2targets indirect cache (the form used in targets generated by tar_nlmixr()).

directory

Cache directory to load the simplified nlmixrui from. Defaults to file.path(targets::tar_config_get("store"), "user/nlmixr2"), mirroring the convention used by targets' own store = targets::tar_config_get("store") defaults — the path resolves at call time against whatever store the user has configured for the running tar_make() (e.g. a tempdir() location set via targets::tar_config_set()).

error

What should happen if any step of a model's chain throws an error? "stop" (the default) lets the error propagate, halting targets::tar_make() as usual. "continue" catches an error from any of the model's steps – simplifying the object, reading its covariates, simplifying the data, or the estimation itself – and 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 a single failed model does not stop the rest of the pipeline. Detect a failed model with inherits(fit, "nlmixr2targetsError") or the broader inherits(fit, "try-error").

Value

A sorted character vector of the covariate names and the occasion-level grouping variable names, possibly empty.

Details

Two kinds of column are read from the data by a model: its covariates, and the grouping variable of each occasion-level random effect. Both are returned, because both have to survive the data simplification: an occasion-level effect written eta ~ var | OCC leaves nlmixr2est stopping with IOV variable 'OCC' is not present in the data if OCC was dropped.

The names are de-duplicated and sorted in the C locale, so reordering the lines of a model, or running on a worker with a different locale, does not change the value and does not rebuild the simplified data.