Pmetrics icon indicating copy to clipboard operation
Pmetrics copied to clipboard

conditional statements in IC block

Open richwilson17 opened this issue 2 years ago • 2 comments

Hi Pmetrics team,

I am running into an issue with the dev build (last downloaded today) when trying to run conditional statements in the initial conditions block. I get the same error when loading a model from a text file or coding in the rscript. For example,

txt #Ini X(1) = IC1 &IF(IC == 0) X(1) = 0 X(2) = IC*V

Rscript ini = list( "X[1] = IC1", "IF(IC == 0) X[1] = 0", "X[2] = IC*V")

After loading data file etc and trying to execute NPAG returns

Error in append(lines, if (is.null(names[i]) || nchar(names[i]) == 0) { : Error: No equation number detected for initial conditions: IF(IC == 0) X[1] = 0

It is working fine in 2.0.2. Flagging for info.

Many thanks, Richard

richwilson17 avatar Sep 06 '23 15:09 richwilson17

That looks like a bug indeed, but I'm also curious why you need the IF statement, and are IC1 and IC different or is that a typo?

mnneely avatar Sep 06 '23 23:09 mnneely

Thank you, Michael. I'm combining two datasets, one with observed dose times and one with no observed dose times but with a pre-dose total level. So have set IC1 (free drug) as a primary variable and IC (total drug) as a covariate in the dataframe (zeroing it off for patients in the observed dose time group).

richwilson17 avatar Sep 07 '23 12:09 richwilson17