-
-
Save kylebaron/f17ca15332fe6f908cf6057795e120e1 to your computer and use it in GitHub Desktop.
WT from function or from parameter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(mrgsolve) | |
code <- ' | |
$GLOBAL | |
double wt_fr_age(const double age) { | |
return(age*2/3); | |
} | |
$PARAM WEIGHT = 5, AGE=2, WTFLAG = 0 | |
$MAIN | |
double WT = WTFLAG==1 ? wt_fr_age(AGE) : WEIGHT; | |
$CAPTURE WT | |
' | |
mod <- mcode("wt",code,warn=FALSE) | |
mod %>% mrgsim | |
mod %>% param(WTFLAG=1) %>% mrgsim |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment