View source: R/convert_nonmem.r
| convert_nonmem | R Documentation |
This function converts a NONMEM model to syntax useable in R simulations. Currently deSolve, rxode2 (nonmem2rx) and mrgsolve are available syntaxes to use Additionally a code to control the simulations is created to directly test the simulations
convert_nonmem(
model,
out,
ext = NULL,
mod_return = NULL,
type_return = "mrgsolve",
overwrite = FALSE,
control = "file",
verbose = TRUE
)
model |
character with the model file to be read in and converted |
out |
character with the name of the output file without a file extension |
ext |
character with the name of the NONMEM ext file (if not provided estimates are read directly from control stream) |
mod_return |
a character vector indicating which items should be returned from the model function. For more information see details |
type_return |
character indicating the type of model that should be created. Currently "deSolve", "rxode2", "nonmem2rx" and "mrgsolve" are accepted |
overwrite |
logical indicating if the output model should be overwritten |
control |
character indicating how the model control code should be returned. Currently "file", "console", "string", "script" and "model" (only for rxode2/DeSolve) are accepted |
verbose |
logical indicating if additional information is written to the console |
For the mod_return argument, the additional variables are added to the output in case the type_return is either mrgsolve or deSolve.
a converted file is generated and a message is returned
Richard Hooijmaijers
mod <- system.file("example_models","PK.1CMT.ORAL.mod", package = "amp.sim")
outf <- tempfile()
convert_nonmem(mod, outf, verbose = FALSE)
readLines(paste0(outf,".cpp")) |> head(n=15) |> cat(sep="\n")
convert_nonmem(mod, outf, verbose = FALSE, type_return = "nonmem2rx") |> suppressMessages()
readLines(paste0(outf,".r")) |> head(n=15) |> cat(sep="\n")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.