| xp_from_bbr | R Documentation |
bbr is a Metrum Research
Group package for managing NONMEM modeling workflows via bbi. It is not
distributed on CRAN (see Additional_repositories in this package's
DESCRIPTION for where to obtain it).
Reading a bbr-managed model into xpose/xpose.xtras normally requires
manually reconstructing the output file path from the model object, e.g.
xtras_data( file = file.path(bbr::get_output_dir(mod), paste0(bbr::get_model_id(mod), ".lst")) )
xp_from_bbr() wraps that pipeline.
xp_from_bbr(.mod, ..., .use_bbr_descr = TRUE)
.mod |
< |
... |
Passed to |
.use_bbr_descr |
< |
An <xp_xtras> object
bbr::read_model(), xtras_data()
if (requireNamespace("bbr", quietly = TRUE)) {
# Build a bbr-style model directory from the bundled pheno_saemimp example
src_dir <- system.file("pheno_saemimp", package = "xpose.xtras")
mod_dir <- tempfile("xp_from_bbr_ex")
dir.create(mod_dir)
file.copy(file.path(src_dir, "run18.mod"), file.path(mod_dir, "18.mod"))
out_dir <- file.path(mod_dir, "18")
dir.create(out_dir)
out_files <- setdiff(list.files(src_dir, pattern = "^run18\\."), "run18.mod")
for (f in out_files) {
file.copy(
file.path(src_dir, f),
file.path(out_dir, paste0("18.", sub("^run18\\.", "", f)))
)
}
# bbr considers a run finished once bbi has written this file
writeLines("{}", file.path(out_dir, "bbi_config.json"))
mod <- bbr::new_model(file.path(mod_dir, "18"), .description = "Phenobarbital SAEM model")
print(xp_from_bbr(mod))
unlink(mod_dir, recursive = TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.