[R] passing command line arguments to 'R CMD BATCH myScript.R'
Oleg Sklyar
osklyar at ebi.ac.uk
Fri Feb 25 15:57:57 CET 2005
Hi Community,
I have a question about how to pass command line parameters to R script
running in the batch mode. The problem is: there is a banch of data
files which are to be processed by R script called from a web-server,
i.e. in the batch mode. The web server generates data files and passes
their names calling 'R CMD BATCH' one by one for every file. Now the
question is how to call 'R CMD BATCH myScript.R' with parameters, like
file name to process? I know how to read the parameters passed to an R
script, but I don't know how to pass them.
There is an option --args that should cut the rest of the line off the
command line. The problem is however that BATCH syntax is: 'R CMD BATCH
[options] inFile [outFile]', i.e. if I write
'R CMD BATCH --args myDataFile myScript.R' or 'R CMD BATCH --args
myDataFile < myScript.R' (similar was posted on some R help under
Windows) it is not going to work because then BATCH doesn't know about
myScript.R - it is considered as a parameter, so only 'R CMD BATCH' is
executed. If however I use 'R CMD BATCH myScript --args myDataFile' then
R understands --args as an output file and generates a file with that name.
Does anyone has a solution for the problem?
Best regards
Oleg
--
Dr Oleg Sklyar
European Bioinformatics Institute
Wellcome Trust Genome Campus
Hinxton, Cambridge, CB10 1SD
England
phone/fax +44(0)1223 49 4478/4468
e-mail osklyar at ebi.ac.uk
More information about the R-help
mailing list