views:

425

answers:

1

Hi,

I would like to suppress output in R when I run my r script from the command prompt.

I tried numerous options including "--slave" and "--vanilla". Those options lessens the amount of text outputted. I also tried to pipe the output to "NUL" but that didn't help.

Thanks a lot, Derek

+9  A: 

Look at help(sink) to do that. On Unix I'd do

sink("/dev/null")    # now suppresses
....                 # do stuff
sink()               # to undo prior suppression, back to normal now

and the Windows equivalent (with a tip-of-the-hat to Johannes) is

sink("NUL")
....
sink()
Dirk Eddelbuettel
Joey
Thank you -- I edited the answer accordingly (after testing that it does indeed work that way with `NUL` quoted properly).
Dirk Eddelbuettel