The easiest way to use this function is via the "view diff" RStudio 'Addin'.
NMproject's control file manipulation functions (e.g. subroutine()
)
may not work for all control files. It is the responsibility of
the user to check automatic manipulations are done properly.
Displaying diffs provides a means of manually checking what was done.
nm_diff(m, ref_m, format = "raw")
An nm object.
An optional nm object (base/reference object). If not
specified, it will compute the diff the initial control file contents
associated with the object at the time of object create. This information
is stored in the ctl_orig
field.
Character (default = "raw"
) argument passed to
diffobj::diffChr()
Invisibly returns a character
vector of the diff.
# 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"))
m2 <- m1 %>% child(run_id = "m2") %>%
subroutine(advan = 2, trans = 2)
nm_diff(m2, m1)
#> < old_ctl
#> > new_ctl
#> @@ 1,3 / 1,3 @@
#> < ;; 1. Based on: NA
#> > ;; 1. Based on: m1
#> ;; 2. Description: 1CMT+oral
#> ;; x1. Author: runner
#> @@ 24,6 / 24,5 @@
#> $INPUT ...
#> $DATA ../../../../../../../../../../Users/runner/work/_temp/Library/NMproject/
#> extdata/examples/theopp/SourceData/THEOPP.csv IGNORE=@
#> < $SUB ADVAN2
#> > $SUB ADVAN2 TRANS2
#> <
#> $PK
#>
#> @@ 32,7 / 31,7 @@
#> KA = EXP(MU_1+ETA(1))
#>
#> < TVK=EXP(THETA(2))
#> > TVCL=EXP(THETA(2))
#> < MU_2=LOG(TVK)
#> > MU_2=LOG(TVCL)
#> < K = EXP(MU_2+ETA(2))
#> > CL = EXP(MU_2+ETA(2))
#>
#> TVV=EXP(THETA(3))
#> @@ 40,5 / 39,5 @@
#> V = EXP(MU_3+ETA(3))
#>
#> < CL = K*V
#> > ; CL = K*V
#>
#> S2 = V
#> @@ 51,14 / 50,12 @@
#> IWRES=IRES/W
#> Y=IPRED + IPRED*EPS(1) + EPS(2)
#> <
#>
#> $THETA
#> ..... ; KA ; h-1 ; LOG
#> < ..... ; K ; h-1 ; LOG
#> > ..... ; CL ; h-1 ; LOG
#> ..... ; V ; L ; LOG
#> <
#> $OMEGA
#> 0.1 ; IIV_KA ; LOG
#> < 0.1 ; IIV_K ; LOG
#> > 0.1 ; IIV_CL ; LOG
#> 0.1 ; IIV_V ; LOG
#>
#> @@ 67,5 / 64,4 @@
#> ..... ; add error
#>
#> <
#> ; Parameter estimation - FOCE
#> ;$EST METHOD=1 INTER NOABORT MAXEVAL=9999 PRINT=1 NSIG=3 SIGL=9
#> @@ 89,9 / 85,9 @@
#>
#> $TABLE ID TIME IPRED IWRES IRES CWRES NPDE
#> < FILE=sdtabm1 NOPRINT ONEHEADER
#> > FILE=sdtabm2 NOPRINT ONEHEADER
#> $TABLE ID ETAS(1:LAST); individual parameters
#> < FILE=patabm1 NOPRINT ONEHEADER
#> > FILE=patabm2 NOPRINT ONEHEADER
#> $TABLE ID ; continuous covariates
#> < FILE=cotabm1 NOPRINT ONEHEADER
#> > FILE=cotabm2 NOPRINT ONEHEADER
#> $TABLE ID ; categorical covariates
#> < FILE=catabm1 NOPRINT ONEHEADER
#> > FILE=catabm2 NOPRINT ONEHEADER