如何燮preSS输出
问题描述:
我想燮preSS输出R中,当我从命令提示符下运行我的ř脚本。
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.
我也尝试管道输出到 NUL
但这并没有帮助。
I also tried to pipe the output to NUL
but that didn't help.
答
看看帮助(汇)
来做到这一点。在Unix上我会做
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
和Windows当量(带尖的最帽子约翰内斯)是
and the Windows equivalent (with a tip-of-the-hat to Johannes) is
sink("NUL")
....
sink()