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
Richard M?ller wrote:> 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)Note the help page R CMD BATCH --help You probably want R CMD BATCH "--args gui=1" Z:/script.R script.out or R --no-save --args gui=1 < Z:/script.R > script.out Uwe Ligges> 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 >