## setDTthreads() is only needed for CRAN. Users should not do this.
data.table::setDTthreads(1)
## end setDTthreads() for CRAN
## notice, examples on explicitly stated lines. Most often in
## practice, one would use the file argument to automatically
## extract the $THETA, $OMEGA and $SIGMA sections from a control
## stream.
text <- c("
$THETA (.1) ;[1]; LTVKA (mL/h)
$OMEGA BLOCK(3)
0.126303 ; IIV.CL ; 1 ;IIV ;Between-subject variability on CL;-
0.024 ; IIV.CL.V2.cov ; 1-2 ;IIV ;Covariance of BSV on CL and V2;-
0.127 ; IIV.V2 ; 2 ;IIV ;Between-subject variability on V2;-
0.2 ; IIV.CL.V3.cov ; 1-3 ;IIV ;Covariance of BSV on CL and V3;-
0.2 ; IIV.V2.V3.cov ; 2-3 ;IIV ;Covariance of BSV on V2 and V3;-
0.38 ; IIV.V3 ; 3 ;IIV ;Between-subject variability on V3;-
$OMEGA 0 FIX ; IIV.KA ; 4 ;IIV ;Between-subject variability on KA;-
$SIGMA 1
")
lines <- strsplit(text,split="\n")[[1]]
res <- NMreadParsText(lines=lines,
format="%init;[%num];%symbol",
format.omega="%init; %symbol ; %num ; %type ; %label ; %unit",
field.idx="num")
## BLOCK() SAME are skipped
text <- c("
$THETA
(0,0.1) ; THE1 - 1) 1st theta
(0,4.2) ; THE2 - 2) 2nd theta
$OMEGA 0.08 ; IIV.TH1 ; 1 ;IIV
$OMEGA BLOCK(1)
0.547465 ; IOV.TH1 ; 2 ;IOV
$OMEGA BLOCK(1) SAME
$OMEGA BLOCK(1) SAME")
lines <- strsplit(text,split="\n")[[1]]
res <- NMreadParsText(lines=lines,
format="%init;%symbol - %idx) %label",
format.omega="%init; %symbol ; %idx ; %label "
)
Run the code above in your browser using DataLab