attach_nlmixr2: Attach nlmixr2 fit object to xpose data object

View source: R/nlmixr2.R

attach_nlmixr2R Documentation

Attach nlmixr2 fit object to xpose data object

Description

Attach nlmixr2 fit object to xpose data object

Usage

attach_nlmixr2(xpdb, obj)

Arguments

xpdb

<xpose_data> The object upon which to attach the fit

obj

<nlmixr2FitData> Result of the nlmixr2 fit

Value

An object of the same class as xpdb with an additional element.

Examples

## Not run: 
# Based on an example from nlmixr2 documentation
xpdb_nlmixr2 <- nlmixr_example("xpdb_nlmixr2")

one.cmt <- function() {
  ini({
    tka <- 0.45 # Ka
    tcl <- log(c(0, 2.7, 100)) # Log Cl
    tv <- 3.45; label("log V")
    eta.ka ~ 0.6
    eta.cl ~ 0.3
    eta.v ~ 0.1
    add.sd <- 0.7
  })
  model({
    ka <- exp(tka + eta.ka)
    cl <- exp(tcl + eta.cl)
    v <- exp(tv + eta.v)
    linCmt() ~ add(add.sd)
  })
}

theo_sd_fit <- nlmixr2::nlmixr2(one.cmt, nlmixr2data::theo_sd,
    "focei", control = nlmixr2::foceiControl(print = 0))

attach_nlmixr2(
  xpdb_nlmixr2, theo_sd_fit
) %>%
  as_xpdb_x() %>%
  print() # fit will be mentioned in print() method

## End(Not run)

xpose.xtras documentation built on April 22, 2026, 1:09 a.m.