[R] Can R scripts executed in batch mode take a commandline argument?
r.ted.byers at gmail.com
Wed Oct 15 21:48:35 CEST 2008
I have examined the documentation for batch mode use of R:
R CMD BATCH [options] infile [outfile]
The documentation for this seems rather spartan.
Running "R CMD BATCH --help" gives me info on only two options: one for
getting help and the other to get the version. I see, further on, that
there are options for retoring and saving sessions (which I do not need to
do in this case), but are there other options defined? If so, what are they
and how are they to be used?
However, it goes on to say: "Further arguments starting with a '-' are
considered as options as long as '--' was not encountered, and are passed on
to the R process, which by default is started with '--restore --save'."
I see here it says further arguments starting with a '-' are passed to the R
process, but usage is not clear. For example, if I write a script that
should take as a commandline argument the name of a file that contains a
series of numbers that I want to place into a vector which, in turn I want
to pass to fitdistr(x,"exponential"), what do I do to get that file name
from the commandline and pass it to, say, "read.csv"?
BTW: How would I tell it that there is no need to restore and save?
If I can't pass a commandline argument, do I have to write the arguments in
afile, and have that file read each time I need to run the script?
View this message in context: http://www.nabble.com/Can-R-scripts-executed-in-batch-mode-take-a-commandline-argument--tp20000914p20000914.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help