[R] batch file output

Joshua Wiley jwiley.psych at gmail.com
Tue Dec 28 20:41:06 CET 2010


On Tue, Dec 28, 2010 at 5:09 AM, Mikkel Grum <mi2kelgrum at yahoo.com> wrote:
> I run a batch file with the following command in Windows XP:
>
> C:\R\R-2.12.1\bin\Rterm.exe --no-save --no-restore <C:\users\me\file.R> C:\users\me\file.out 2>&1

I'm a bit surprised this worked for you...did you customize your build
so that Rterm.exe is in \bin\ rather than a subfolder for its specific
architecture?

> Is there any way to get only the output of R in file.out, without getting all the code from file.R too?

I did not see anyone else mention this, so I wanted to add that with R
CMD BATCH you can add the --slave argument to avoid needing to add
options(echo = FALSE) to all your scripts.  The --no-timing option
stops proc.time() from running at the end.

For example from the command prompt I can run 'sample.R' using 32 bit R:

C:\R\R-2.12.1\bin\i386\R CMD BATCH --slave --no-timing "sample.R"
"sampleout.txt"

HTH,

Josh

> Any help greatly appreciated,
> Mikkel
>
> ______________________________________________
> R-help at 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.

-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/



More information about the R-help mailing list