[R] args and test of passed paramters
Juergen Rose
rose at rz.uni-potsdam.de
Fri Apr 17 17:39:01 CEST 2009
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
More information about the R-help
mailing list