Update $SIZES parameters in a control stream. The control stream can be in a file or provided as a character vector (file lines).
Usage
NMupdateSizes(
file.mod = NULL,
newfile,
lines = NULL,
wipe = FALSE,
write = !is.null(newfile),
...
)
Arguments
- file.mod
A path to a control stream. See also alternative `lines` argument. Notice, if `write` is `TRUE` (default) and `newfile` is not provided, `file.mod` will be overwritten.
- newfile
An optional path to write the resulting control stream to. If nothing is provided, the default is to overwrite `file.mod`.
- lines
Control stream lines as a character vector. If you already read the control stream - say using `NMdata::NMreadSection()`, use this to modify the text lines.
- wipe
The default behavior (`wipe=FALSE`) is to add the `$SIZES` values to any existing values found. If SIZES parameter names are overlapping with existing, the values will be updated. If `wipe=TRUE`, any existing `$SIZES` section is disregarded.
- write
Write results to `newfile`?
- ...
The $SIZES parameters. Provided anything, like `PD=40` See examples.
Examples
## No existing SIZES in control stream
if (FALSE) { # \dontrun{
file.mod <- system.file("examples/nonmem/xgxr032.mod",package="NMsim")
NMupdateSizes(file.mod,LTV=50,write=FALSE)
} # }
## This controls stream has existing SIZES
if (FALSE) { # \dontrun{
file.mod <- system.file("examples/nonmem/xgxr134.mod",package="NMsim")
NMupdateSizes(file.mod,LTV=50,write=FALSE)
} # }
## provide control stream as text lines
if (FALSE) { # \dontrun{
file.mod <- system.file("examples/nonmem/xgxr032.mod",package="NMsim")
lines <- readLines(file.mod)
NMupdateSizes(lines=lines,LTV=50,write=FALSE)
} # }