Description Usage Arguments Details Value Author(s) References See Also Examples
as.nmctl
and read.nmctl
normally return a list of character vectors as class nmctl
. Users are free to modify these using conventional techniques for text. Optionally, the theta
record can be converted to an object of class initList
– either manually, using as.initList
, or by the
functions above, passing parse=TRUE
. initList
is a numbered list of objects of class init
, each of which can be modified using regular R syntax for lists and vectors. Conveniently, the object number is the same as NONMEM's index for THETA: e.g. ctl$theta[[3]]
represents THETA3.
1 2 3 4 5 6 |
x |
object of interest |
fixed |
logical: whether the value should be fixed at the initial estimate. |
comment |
character: a comment |
... |
ignored |
Class init
represents an initial estimate, e.g. for an element of THETA. Using the NONMEM help conventions, the estimate is composed of three elements: a lower bound, the estimate itself, and an upper bound; these are named "low", "init", and "up", respectively. They are always present, whether or not displayed. Each may have a numeric value. Furthermore, "low" may be -Inf
(default), "init" may be NA
(if "low" and "up" are finite) and "up" may be Inf
(default). init
may be constructed from numeric vector of length one ('init'), two ('low' and 'init') or three ('low','init','up').
Elements of class init
may be accessed using subset operators ([]
, or either version of the element-select operator ([[]]
,$
); assignment is supported for all three cases. Note that a subset of class init
is not itself of that class.
In contrast, a subset of class initList
retains its class. initList
is a list of objects of class init
. Members may be accessed and assigned using []
and [[]]
. initList
may be created by parsing a file or by calling as.initList
on a character or numeric vector.
The concept "fixed" is supported. fixed()
checks whether an init
is fixed, either singly or member-wise for elements of initList
. fixed() <-
assigns the value TRUE
or FALSE
; for initList
, the supplied value is recycled as necessary to match the length of the primary object. Internally, "fixed" simply means that "low", "init", and "up" are finite and identical.
Comments are supported. Comments can be multi-line, and will be printed following a line representing the initial estimate itself. When parsing, comments on the same line as – or following a set of – estimates are replicated for all such estimates (perhaps only one). If an estimate is split across lines, comments for each of those lines are aggregated and associated with the estimate as a whole (and are printed after the estimate). Comments occuring before the first line of numeric material will be associated with the list as a whole, and will be printed before the list. Comments may be accessed using comment()
and assigned using comment() <-
.
object of class init
, or a numbered set of these, having class initList
.
Tim Bergsma
http://metrumrg.googlecode.com
as.nmctl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | path <- system.file('example/project/nonmem/ctl/1005.ctl',package='metrumrg')
ctl <- read.nmctl(path,parse=TRUE)
theta <- ctl$theta
theta[[3]]$init
x <- as.initList('(0,3) 2 FIXED (0 .6 1) 10 (-INF,-2.7,0) (37 FIXED) ')
x
fixed(x)
fixed(x) <- TRUE
x
writeLines(as.character(x))
fixed(x) <- FALSE
x
x[[1]]
as.init(1:3)
as.initList(1:3)
as.initList(1:3,fixed=TRUE)
x <- as.initList(1:4)
x
x[1:3]
x[1:2] <- x[3:4]
x
x[[4]]
fixed(x[[4]])
fixed(x[[4]]) <- TRUE
x
x[[4]]$up
x[[4]]$up <- Inf
x[[4]]
fixed(x[[4]])
x[[4]][['up']]
x[[4]][c('low','up')]
x <- c(
';thetas',
'10 20; structural',
'; literature',
'(',
'0,;ref A',
'5,;ref B',
'10)'
)
writeLines(as.character(as.initList(x)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.