R 中的 sprintf( "%s not found! Interpreting dose as nanomolar concentrations." ) 中的错误



我在R 3.6.3中遇到了与sprint错误相关的问题(使用Rstudio终端选项卡(。让我知道如何解决以下错误。

-Rstudio终端选项卡中使用的命令-

Rscript AP_simulation.R -d drug1 -x "1-10,15,20,25" --cmaxfile="my_cmax_table.csv" --hergpath="path/to/herg/results/" --hillpath="path/to/hill/results/"-

-错误结果示例-

loaded via a namespace (and not attached):
[1] compiler_3.6.3 getopt_1.20.3
Error in sprintf("%s not found! Interpreting dose as nanomolar concentrations.") :
Calls: print -> sprintf

-R发生错误的代码-

#--- get therapeutic concentration (Cmax)
if(drug=="control"){
cmax<-0
}else{
if(!file.exists(cmaxfile)){
cmax<-1
print(sprintf("%s not found! Interpreting dose as nanomolar concentrations."))
}else{
drugtable<-read.csv(cmaxfile)
cmax<-drugtable[as.character(drugtable$drug)==drug,"therapeutic"] # should be in nanomolar
if(length(cmax)==0){
cmax<-1
print(sprintf("Cmax undefined, interpreting dose as nanomolar concentrations."))
}else if(length(cmax)==1){
print(sprintf("Cmax set to %g nM, interpreting dose as multiples of Cmax.",cmax))
}else{
stop("Multiple entries for %s therapeutic concentration!",drug)
}
}
}
print(sprintf("%s not found! Interpreting dose as nanomolar concentrations."))

缺少sprintf()的参数。由于%s是一个字符的占位符,因此应在此处打印。示例:

for(i in c("One", "Two", "Three")){
print(sprintf("This is Iteration Number %s", i))
}

最新更新