如何抑制输出

时间:2010-03-23 16:54:42

标签: powershell r batch-file

当我从命令提示符运行R脚本时,我想抑制R中的输出。

我尝试了很多选项,包括--slave--vanilla。这些选项减少了输出的文本量。

我还尝试将输出传递给NUL,但这没有帮助。

1 个答案:

答案 0 :(得分:31)

help(sink)来做到这一点。在Unix上我会做

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

和Windows等价物(对约翰内斯有一个小费)是

sink("NUL")
....
sink()