Hi,
I would like to call a R script sometimes with:
  R --slave --vanilla --args Debug=1 N=25 < test.R 
and sometimes with
  R --slave --vanilla Debug=1 < test.R 
or similar.

Inside the R script I get the arguments with:

args=(commandArgs(TRUE))
if(length(args)==0){
  print("===    No arguments supplied. =============")
}else{
  for(i in 1:length(args)){
    eval(parse(text=args[[i]]))
  }
}

But I don't know, how can I test inside the script if the parameter N
was passed to script or not. I am looking for something like
is.defined(N), but I could not find it until now.

Any hint?

Juergen

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to