On Fri, 4 Jan 2008, Bernd Jagla wrote: > Hi, > > I would like start R in BATCH mode and submit my own parameters. Or in other > words, I would like to specify variables from the command line and execute a > script using those. > > I have been looking at commandArgs and calling R from the command line under > bash: > > R CMD BATCH --no-save --args -filename="$filname" -- r-test.R r-test.Rout > > The problem here is, if $filename contains a space it is regarded as a new > parameter which makes it more difficult to parse.
On a Unix-alike and not Windows, I presume. You need to double quote the variable. > Also, are there function that help parse the parameters? ?commandArgs, as you have mentioned. > Or, is there a totally different this is usually done in R? Use Rscript. -- 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 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.