DNAm-based-age-predictor
DNAm-based-age-predictor copied to clipboard
Error in if (args[i] == "-i") { : missing value where TRUE/FALSE needed
Hi, Dear Qian,
When I run source("pred.R"), I received this error message: Error in if (args[i] == "-i") { : missing value where TRUE/FALSE needed
Do you know what this means and how can I solve it? Thank you!
Best wishes, Shi
Hello there,
I will reply in case anyone else has this issue. This occurs only when trying to run the source code. If You run the script using command line, this issue will not appear.
It happens due to arguments provided in the command line not being available while running the source code, to fix it and run the script you can include input files like this(lines 23-25):
infile<-c("data.rds") ########## input file name
outfile<-c("age.pred") ########## output file name
agefile<-c("data.age") ########## file with individual ID and age
and remove the check for arguments(lines 27-35):
# for(i in 1:(length(args)-1)){
# if(args[i]=="-i"){
# infile<- args[i+1]
# }else if(args[i]=="-o"){
# outfile<- args[i+1]
# }else if(args[i]=="-a"){
# agefile<- args[i+1]
# }
#}
Good luck, Woo