Closed sbihorel closed 5 years ago
Hi @sbihorel
[ PROB ]
Everything in here is a "comment" ... any text you want ... it will do nothing.
sqrt("foo") ... no problem!
To comment out a line (anywhere):
[ MAIN ] // like $PK
// PK parameters
double CL = THETA21; // Clearance
You can use shift-(control|command)-C in Rstudio to comment out a block.
Does this help?
Thanks @kylebmetrum
Yes, I think it does... although I feel I have to ask a follow-up question though (please, bear with me, I am just starting to read the user manual): I thought that the .cpp files used the $MAIN notation (not [ MAIN ] notation). Does "//" indicates a comment also in the .cpp files?
@sbihorel Happy to answer any question.
[ MAIN ]
is the same thing as $MAIN
; I started with $MAIN
because it looked like NONMEM, but it doesn't play very well with Rstudio editor when the file extension is .cpp
. You can use either, but I've been using the brackets more lately.
There is one comment character / sequence: //
that comments stuff out anywhere in the file
I usually have been writing model files with .cpp
extension because it gets syntax highlighting in Rstudio; but it isn't all great because the code isn't all C++ code. Anyway, in recent versions you can use any file extension you want and if you use model.txt
Rstudio won't assume you're writing any code and will tend to stay out of your business. I guess none of this matters if you're using some other editor.
Please don't hesitate to follow up if one of the points isn't clear.
That's crystal clear !
Thanks
Hi
I get compilation errors when I use // in [ PARAM ] @annotated block. I don't get the error if the block is not annotated.
Please post an example that isn’t working along with the error message you’re getting. Thanks.
All of this should be valid
library(mrgsolve)
code <- '
[ PARAM ] @annotated // test
// test
CL : 1 : clearance //test
VC : 20 : volume // test
// test
'
mod <- mcode("foo", code)
#> Building foo ... done.
param(mod)
#>
#> Model parameters (N=2):
#> name value . name value
#> CL 1 | VC 20
Created on 2019-02-03 by the reprex package (v0.2.1)
Hi
> require(mrgsolve)
Loading required package: mrgsolve
> code <- '[ PARAM ] @annotated // comment
+ // comment
+ TVCL : 3 : Elimination Clearance (-) // comment
+ TVVC : 10 : Central Volume (-)
+ TVQ : 0.5 : Distribution Clearance (-)
+ TVVP : 75 : Peripheral Volume (-)
+ TVKA : 0.5 : First-order Absortion Rate (1/h)
+ TVBASE: 50 : Baseline Response (-)
+ TVKOUT: 0.01 : Elimination Rate of Response (-)
+ TVIMAX: 0.5 : Maximum Inhibition (-)
+ TVIC50: 10 : Half-inhibitory Concentration (-)'
> mod <- mcode('foo', code)
Error: improper annotation format
Context: not given
> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 18.3
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] mrgsolve_0.9.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.0 crayon_1.3.4
[3] dplyr_0.7.8 assertthat_0.2.0
[5] R6_2.2.2 magrittr_1.5
[7] pillar_1.3.0 rlang_0.3.1
[9] RcppArmadillo_0.8.400.0.0 bindrcpp_0.2.2
[11] tools_3.4.4 glue_1.2.0
[13] purrr_0.2.4 compiler_3.4.4
[15] pkgconfig_2.0.1 bindr_0.1.1
[17] tidyselect_0.2.4 tibble_1.4.2
Thanks; looks like it's the leading space that is causing the issue there. I'll address open another issue for this.
> code <- '[ PARAM ] @annotated // comment
+ // comment
+ TVCL : 3 : Elimination Clearance (-)
+ TVVC : 10 : Central Volume (-)
+ TVQ : 0.5 : Distribution Clearance (-)
+ TVVP : 75 : Peripheral Volume (-)
+ TVKA : 0.5 : First-order Absortion Rate (1/h)
+ TVBASE: 50 : Baseline Response (-)
+ TVKOUT: 0.01 : Elimination Rate of Response (-)
+ TVIMAX: 0.5 : Maximum Inhibition (-)
+ TVIC50: 10 : Half-inhibitory Concentration (-)
+ '
>
> mcode("foo", code)
Building foo ... done.
------------ mrgsolve model object (unix) ------------
project: /private/var/fol.../T/RtmpTIW9xt
source: foo.cpp
shared object: foo-so-8f76a6ccec4
time: start: 0 end: 24 delta: 1
add: <none>
tscale: 1
compartments: <none>
parameters: TVCL TVVC TVQ TVVP TVKA TVBASE TVKOUT
TVIMAX TVIC50 [9]
omega: 0x0
sigma: 0x0
solver: atol: 1e-08 rtol: 1e-08
maxsteps: 5000 hmin: 0 hmax: 0
Hi
Is there a specific syntax that allow the insertion of random comments in a model file (especially before the very first $XXX code block)?
Thanks