R/preProcessCovariatesPresent.R

Defines functions .nlmixr0preProcessCovariatesPresent

Documented in .nlmixr0preProcessCovariatesPresent

#' Preprocess Covariates needed (or other data items)
#'
#' @param ui rxode2 ui
#' @inheritParams nlmixr2
#' @return list with the ui (possibly modified)
#' @export
#' @author Matthew L. Fidler
.nlmixr0preProcessCovariatesPresent <- function(ui, est, data, control) {
  # Could later support stacking data or custom DV/IDV columns.

  if (!missing(data) &&
        length(data) > 0L &&
         isTRUE(attr(utils::getS3method("nlmixr2Est", est), "covPresent"))) {
    .covNames <- ui$covariates
    .newNames <- .nmUpcaseNonCov(names(data), .covNames)
    colnames(data) <- .newNames
    requiredCols <- c("TIME", .covNames)
    checkmate::assert_names(.newNames, must.include = requiredCols)
  }
  NULL
}

preProcessHooksAdd(".nlmixr0preProcessCovariatesPresent", .nlmixr0preProcessCovariatesPresent)

Try the nlmixr2est package in your browser

Any scripts or data that you put into this service are public.

nlmixr2est documentation built on Aug. 5, 2026, 1:11 a.m.