[R] passing args from the command line

Richard Müller r.mueller at oeko-sorpe.de
Tue Jan 1 13:22:07 CET 2008


Happy New Year to all!

I want to run a script from a directory on a central server on different 
machines, linux and windows. To determine which machine is calling the script 
I want to pass an argument with the call (e.g. for choosing the display 
device, for writing path names etc.)
I tried the following:
R CMD BATCH --args gui=4 /home/script.R script.out (linux)
resp. Rcmd BATCH --args gui=1 Z:/script.R script.out (windows)

The script started with
args(commandArgs(TRUE)) # thanks to James Forester for his R-concerning blog

script.out says: Error in commandArgs(TRUE): unused argument(s) (linux)
windows says: input file --args cannot be opened

Something must be going wrong (but different things on Win and Linux) (but 
what?)
Richard

-- 
Richard Müller - Am Spring 9 - D-58802 Balve-Eisborn
www.oeko-sorpe.de




More information about the R-help mailing list