| nlmixr2saveShare | R Documentation |
Writes a portable .zip copy of a saved fit that omits the original dataset
(the subject-level data), so a fitted model can be shared without its data.
The input may be a live fit object or the base name of an existing saved fit
.zip; either way the original is left unchanged and new sibling zips are
written. Names are resolved through getOption("nlmixr2save.dir") and
getOption("nlmixr2save.prefix") (as for the := cache).
nlmixr2saveShare(x, noFit = FALSE, file = NULL)
x |
a fitted model object, or the base name (no extension) of a saved
fit |
noFit |
Boolean; when |
file |
optional output base name; defaults to the name of |
nlmixr2saveShare("fit") writes fit-noData.zip – the full fit
(predictions and tables intact) with the original data removed.
nlmixr2saveShare("fit", noFit=TRUE) writes fit-noData-noFit.zip – the
core fit only (model, parameter estimates, objective, omega, etaObf,
parHistData), with both the original data and the returned
prediction/residual table removed.
the path of the written .zip, invisibly.
Matthew L. Fidler
saveFit(), loadFit()
if (requireNamespace("nlmixr2est", quietly=TRUE) &&
requireNamespace("nlmixr2data", quietly=TRUE) &&
requireNamespace("withr")) {
library(nlmixr2est)
library(nlmixr2data)
withr::with_tempdir({
one.cmt <- function() {
ini({
tka <- 0.45; tcl <- log(c(0, 2.7, 100)); tv <- 3.45
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)
})
}
fit <- nlmixr2(one.cmt, theo_sd, est="focei")
saveFit(fit) # fit.zip (with data)
nlmixr2saveShare("fit") # fit-noData.zip
nlmixr2saveShare("fit", noFit=TRUE) # fit-noData-noFit.zip
})
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.