There is another solution that the helpers might like to be aware of. Anything on the command line after --args is ignored but can be retrieved by commandArgs. So suppose I have a script
quote.R: commandArgs()[-(1:3)] q() and a batch file quote.bat: Rterm.exe --slave --args %* < quote.R Then [c:/R]% quote.bat foo bar bah [1] "foo" "bar" "bah" If people would cooperate (an identical message was sent to R-bugs this morning, PR#7201), we might feel inclined to add such things to the documentation. On Fri, 27 Aug 2004, Roger Bivand wrote: > On Fri, 27 Aug 2004, Kishore, Tapake wrote: > > > Hi, > > > > I am trying the 'R' application for generating the data for the uploaded > > '.gpr' file. I have written script file named 'test.R'. Currently i have > > hardcoded the path of uploaded '.gpr' file in the script itself. > > > > Typically, you can write a batch file that sets environment variables, and > then calls R with your script file, accessing the environment variables > from your R script using Sys.getenv(). This means that the values are not > hard-coded in your script - just the environment variable names - and that > the values inserted into the environment variables in your batch file are > accessible within the script as values using the function mentioned. > > > > I would like to know how to pass a command line parameter to the > > 'test.R' script file, so that i dont have to hardcode the path and > > filename of the '.gpr' files. Also, need to access these parameters > > inside the script file to use the path of the uploaded file. I am using > > below command to invoke the 'R' application by using the 'test.R' script > > file. > > > > e.g. > > c:\\R\\rw1091\\bin\\R.exe CMD BATCH c:\\R\\rw1091\\bin\\test.R > > > > Expecting your suggestion on this. > > > > Thanks in advance. > > > > Regards, > > Kishore -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
