The fast way to see the contents of a particular subroutine directly in the R console. It can also be used to set the contents of a NONMEM subroutine in place of manual edits
dollar(m, dollar, ..., add_dollar_text = TRUE)
An nm object.
Character. Name of NONMEM subroutine to target.
Additional arguments to be passed to text()
. If specified these
will set the contents of the subroutine. See examples below.
Logical (default = TRUE
). Should the $XXXX string be
added to text.
If dollar
is specified returns the relevant subroutine of the
control file as a character. Otherwise returns an nm object with modified
ctl_contents
field.
# create example object m1 from package demo files
exdir <- system.file("extdata", "examples", "theopp", package = "NMproject")
m1 <- new_nm(run_id = "m1",
based_on = file.path(exdir, "Models", "ADVAN2.mod"),
data_path = file.path(exdir, "SourceData", "THEOPP.csv"))
m1 %>% dollar("PK") ## displays existing $PK
#> $`execute.Models/m1`
#> 1| $PK
#> 2|
#> 3| TVKA=EXP(THETA(1))
#> 4| MU_1=LOG(TVKA)
#> 5| KA = EXP(MU_1+ETA(1))
#> 6|
#> 7| TVK=EXP(THETA(2))
#> 8| MU_2=LOG(TVK)
#> 9| K = EXP(MU_2+ETA(2))
#> 10|
#> 11| TVV=EXP(THETA(3))
#> 12| MU_3=LOG(TVV)
#> 13| V = EXP(MU_3+ETA(3))
#> 14|
#> 15| CL = K*V
#> 16|
#> 17| S2 = V
#> 18|
#>
m1 %>% dollar("THETA")
#> $`execute.Models/m1`
#> 1| $THETA
#> 2| ..... ; KA ; h-1 ; LOG
#> 3| ..... ; K ; h-1 ; LOG
#> 4| ..... ; V ; L ; LOG
#> 5|
#>
c(m1, m1) %>% dollar("THETA") # display $THETAs for multiple NONMEM runs
#> $`execute.Models/m1`
#> 1| $THETA
#> 2| ..... ; KA ; h-1 ; LOG
#> 3| ..... ; K ; h-1 ; LOG
#> 4| ..... ; V ; L ; LOG
#> 5|
#>
#> $`execute.Models/m1`
#> 1| $THETA
#> 2| ..... ; KA ; h-1 ; LOG
#> 3| ..... ; K ; h-1 ; LOG
#> 4| ..... ; V ; L ; LOG
#> 5|
#>