Skip to content
Prev 205200 / 398506 Next

Rscript: how to suppress all output

On Sat, 2 Jan 2010, johannes rara wrote:

            
Rscript test.r >& /dev/null

or equivalent in your shell.  But note that Rscript produces no 
output itself:

tystie% touch test.r
tystie% Rscript test.r
tystie%

so anything you see is created by your script.  If your script 
produces output you do not want, the problem lies in your script. 
Depending how it is doing it, consider functions like invisible(), 
sink() and suppressMessages().
--slave is the default for Rscript: use Rscript --verbose to see what 
it is doing (see ?Rscript).
(That one is because you did not specify methods as part of the 
initial package list: see ?Rscript.)