Robin Hankin
2003-May-29 21:27 UTC
[R] R CMD BATCH --vanilla --slave produces unwanted lines
Hello list (thanks for all the help on my data.frame() question, especially to Professor R for a working script...I was pleased to see the solution wasn't obvious!) Anyway, now I'm trying to run R in batch mode, but I'm getting extra output, which I don't want (RedHat 8.3, R-1.7.0): r:~% cat test.R options(echo=FALSE) write(rnorm(4),"") r:~% R CMD BATCH --vanilla --slave test.R r:~% cat test.Rout> options(echo=FALSE)0.1500393 0.1067567 0.2707306 -1.657154 [1] 1.82 0.07 1.87 0.00 0.00 r:~% I just want the four random variables, not the "options(echo=FALSE)" line nor the final line which looks like the output of a proc.time() call (how come this is called at all if I'm using the --vanilla flag?) How do I arrange for test.Rout to contain just a single line of four random variables? -- Robin Hankin, Lecturer, School of Geography and Environmental Science Tamaki Campus Private Bag 92019 Auckland New Zealand r.hankin at auckland.ac.nz tel 0064-9-373-7599 x6820; FAX 0064-9-373-7042
Thomas W Blackwell
2003-May-30 11:51 UTC
[R] R CMD BATCH --vanilla --slave produces unwanted lines
Supply a separate output file name explicitly to write(). - tom blackwell - u michigan medical school - ann arbor - On Fri, 30 May 2003, Robin Hankin wrote:> Anyway, now I'm trying to run R in batch mode, but I'm getting extra > output, which I don't want (RedHat 8.3, R-1.7.0): > > r:~% cat test.R > options(echo=FALSE) > write(rnorm(4),"") > > r:~% R CMD BATCH --vanilla --slave test.R > r:~% cat test.Rout > > options(echo=FALSE) > 0.1500393 0.1067567 0.2707306 -1.657154 > [1] 1.82 0.07 1.87 0.00 0.00 > r:~% > > I just want the four random variables, not the "options(echo=FALSE)" > line nor the final line which looks like the output of a proc.time() > call (how come this is called at all if I'm using the --vanilla flag?) > > How do I arrange for test.Rout to contain just a single line of four > random variables? > > Robin Hankin, Lecturer, > School of Geography and Environmental Science > Tamaki Campus > Private Bag 92019 Auckland > New Zealand > > r.hankin at auckland.ac.nz > tel 0064-9-373-7599 x6820; FAX 0064-9-373-7042 >
David Brahm
2003-May-30 16:44 UTC
[R] R CMD BATCH --vanilla --slave produces unwanted lines
Robin Hankin <r.hankin at auckland.ac.nz> wrote:> Anyway, now I'm trying to run R in batch mode, but I'm getting extra > output, which I don't want (RedHat 8.3, R-1.7.0):...> r:~% R CMD BATCH --vanilla --slave test.RWhy not just run: unix> R --vanilla --slave < test.R > test.out Then the "options(echo=FALSE)" line is unnecessary. Note an explicit q() at the end of the script eliminates a single blank line that occurs otherwise. So the test.R script is just: write(rnorm(4),"") q() -- -- David Brahm (brahm at alum.mit.edu)