No such thing as a small change | |
PerlMonks |
Re^3: Passing parameters to R scriptby Anonymous Monk |
on Jun 08, 2010 at 09:39 UTC ( [id://843631]=note: print w/replies, xml ) | Need Help?? |
That works fine, but there's a slightly neater way to do it; if you provide a TRUE value to the commandArgs function, it ignores any commandline parameters before (and including) --args.
So with Args <- commandArgs(TRUE), Args[1] is "100", and is the only element of the vector. It's also possible to use a simpler syntax to call the script on the command line, which implicitly assumes that any arguments are given after the script name: Rscript test.R 100 Cheers, Julio
In Section
Seekers of Perl Wisdom
|
|