This function is typically not needed by end users.
Usage
nlmixr_data_simplify(
data,
object,
table = list(),
directory = file.path(targets::tar_config_get("store"), "user/nlmixr2"),
est = NULL,
control = NULL,
covariates = NULL,
error = c("stop", "continue")
)Arguments
- data
nlmixr data
- object
The model, in either form
nlmixr_object_covariates()accepts: annlmixrui object, or a character md5 hash identifying a simplified ui in thenlmixr2targetsindirect cache.- table
The output table control object (like `tableControl()`)
- directory
Cache directory to load the simplified
nlmixruifrom. Defaults tofile.path(targets::tar_config_get("store"), "user/nlmixr2"), mirroring the convention used bytargets' ownstore = targets::tar_config_get("store")defaults — the path resolves at call time against whatever store the user has configured for the runningtar_make()(e.g. atempdir()location set viatargets::tar_config_set()).- est
estimation method (all methods are shown by `nlmixr2AllEst()`). Methods can be added for other tools
- control
The estimation control object. These are expected to be different for each type of estimation method
- covariates
The model's covariate column names, as returned by
nlmixr_object_covariates(). Supply exactly one ofobjectandcovariates.- error
What should happen if any step of a model's chain throws an error?
"stop"(the default) lets the error propagate, haltingtargets::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 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 a single failed model does not stop the rest of the pipeline. Detect a failed model withinherits(fit, "nlmixr2targetsError")or the broaderinherits(fit, "try-error").
Value
The data with the nlmixr2 column lower case and on the left and the covariate columns on the right and alphabetically sorted.
Details
The standardization keeps columns that rxode2 and nlmixr2 use along with the covariates. Column order is standardized (rxode2 then nlmixr2 then alphabetically sorted covariates), and rxode2 and nlmixr2 column names are converted to lower case.
est and control only affect which columns are kept: with the default
est = NULL, or any estimation method other than "vae", the standard
and model covariate columns above are all that is kept. When
est = "vae", the automated covariate selection searches
subject-constant data columns beyond the covariates named in the model, so
the candidate columns reported by nlmixr2est::vaeCovariates() (honoring
the shapes, covCenterType, covCenter, and catCutoff settings in
control) are kept as well. Columns the search cannot use (for example
time-varying or partially-missing columns) are still dropped; the exclusion
warnings that nlmixr2est::nlmixr() would raise for them are raised here
instead, because the estimation step never sees the dropped columns.
The model is consulted only for its covariate names, so it can be given
either as object or, already reduced to those names, as covariates.
The targets generated by tar_nlmixr() pass covariates, so the data
target depends on the covariate names rather than on the whole model: an
edit to the model that leaves its covariates unchanged does not rebuild the
simplified data.
See also
Other Simplifiers:
nlmixr_object_complicate(),
nlmixr_object_covariates(),
nlmixr_object_simplify()