[R] R CMD BATCH *without* saving output
wdunlap at tibco.com
Thu Jul 24 19:42:48 CEST 2014
You also might try wrapping the call to the scripts with capture.output().
On Thu, Jul 24, 2014 at 9:54 AM, Nick Matzke <matzke at berkeley.edu> wrote:
> Actually, this was the full solution:
> At the beginning of the script:
> # Suppressing all output/warnings/try errors:
> # Open connection to black hole
> # Don't print anything to screen
> sink(file=con, type="output")
> # Don't print messages (e.g. errors/warnings)
> sink(file=con, type="message")
> At the end of the script:
> # Turn off output sink
> # Turn off message sink
> # Close connection to black hole
> On Thu, Jul 24, 2014 at 12:27 PM, Nick Matzke <matzke at berkeley.edu> wrote:
>> On Thu, Jul 24, 2014 at 12:16 PM, Nick Matzke <matzke at nimbios.org> wrote:
>>> Hi all,
>>> Hi have a series of scripts that print a lot of notes etc. to screen. I
>>> have to run them on a massive set of input files. The scripts are
>>> self-contained and save the important output to data files in an organized
>>> way. I don't need the screen output for anything.
>>> - If I run the script from the R command line, the output printed to
>>> Terminal got so huge that it crashed Terminal (I was running 10 of these at
>>> - I tried R CMD BATCH, but this just created .Rout files that are size
>>> 50 GB and counting.
>>> I suppose I could be a grownup and refactor all my code with print
>>> options that I can turn off, but I would rather be lazy.
>>> So, is there a way to run R CMD BATCH or something similar, and NOT print
>>> the output to screen or to the .Rout file?
>>> I tried:
>>> R CMD BATCH --no-save , but that still seems to save the the screen
>>> output etc. to .Rout.
>> Here is one likely solution to the above question (also, I am now sending
>> from the email address that is subscribed to R-help):
>> ...at the beginning of the script. All screen output now goes to the black
>> hole of /dev/null and is not saved.
>> At the end of the script, put
>> ...to turn this behavior off.
>> (Tip courtesy of Brian O'Meara)
>> There may be even easier solutions, if so, I'm still interested, since I
>> couldn't find anything obvious googling R CMD BATCH (although this function
>> seems to have many options not listed in the help for R CMD BATCH).
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help