Pmetrics
Pmetrics copied to clipboard
SIMrun will not create csv if all but one covariates are fixed
During some testing with SIMrun, I encountered an error.
When the number of non-fixed covariates to be simulated is one, SIMrun will fail to create a csv-file with the data.
This is the error: Error in (nfixed + 1):(nfixed + ncol(covDF)) : argument of length 0
.
I believe this error is because ncol(covDF)
evaluates to NULL
.
Here is a minimal example reproducing the error:
library(Pmetrics)
PMwriteMatrix(data = mdata.1, filename = "template.csv")
writeLines(model, con = "model.txt")
SIMrun(makecsv = "simdata.csv", include = 1, model = "model.txt",
data = "template.csv", poppar = final.1, nsim = 10,
covariate = list(cov = cov.1, fix = c("africa","age","gender","height")))
Setting obsNoise to model file assay error. When making a csv file, you cannot specify no obsNoise.
Model solver mode: Algebraic Number of compartments: 2, including an absorptive compartment Primary Variables: Ka, Ke, V, Tlag1, wt Covariates in data file: africa, age, gender, height Covariates used in model file: africa, age, gender, height Secondary Variables: KCP, KPC Model conditions: no bioavailability term defined, initial conditions are zero, lag term defined
The following subject(s) in the data will serve as the template(s) for simulation: 1
Simulating from subject 1 ... Error in (nfixed + 1):(nfixed + ncol(covDF)) : argument of length 0