On Wed, 15 Oct 2008, cls59 wrote:
On Unix/Linux platforms, you can use the included Rscript utility by adding the following shebang at the top of your program. Command line arguments can then be retrieved using the commandArgs function: #!/usr/bin/Rscript args <- commandArgs(trailingOnly = TRUE) args is now a character vector containing every space delimited text string that followed your program name when you ran it. trailingOnly is set to TRUE because the RScript interpreter prepends a few arguments of it's own that you will probably have no use for. As I stated earlier, this approach works great on Unix/Linux systems, I havn't tested it in a Windows environment.
There is no support for #! in the standard Windows shell. Also, you need to make the script executable in a Unix-alike, and there's no concept of that on Windows file systems. But the Cygwin shells have an emulation.
This is mentioned in 'An Introduction to R', the most basic R manual.
Good Luck! -Charlie ----- Charlie Sharpsteen Undergraduate Environmental Resources Engineering Humboldt State University
-- 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.