Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in if (args[i] == "-i") { : missing value where TRUE/FALSE needed #2

Open
MinS1 opened this issue Nov 15, 2022 · 1 comment
Open

Comments

@MinS1
Copy link

MinS1 commented Nov 15, 2022

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

@woohoos
Copy link

woohoos commented Nov 20, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants