[R] commandArgs()

R A F raf1729 at hotmail.com
Mon May 5 16:34:57 CEST 2003


Apologies for asking about this, but I don't quite understand how
this works after looking through the FAQ and the Help archives.

Let's say I want to pass "1000" as an argument to R.  I did the
following:

>R CMD BATCH --1000 infile outfile

When I do print( commandArgs() ), I see

[1] ".../R.bin"         "--restore"
[3] "--save"            "--no-readline"
[5] "gui=none"          "--1000"

So commandArgs()[6] is the argument I want.  Does one then go on and
remove the "--" manually and cast this as numeric?  If so, what's the
usual way to do this?  Or am I not understanding this mechanism
properly?

Thanks very much.




More information about the R-help mailing list