简体   繁体   中英

How to suppress output

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.

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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM