Disabling the cat command

后端 未结 5 1226
别跟我提以往
别跟我提以往 2020-12-16 15:16

Suppose I have the following function:

## Just an example
f = function() { 
  for(i in 1:10000)
      cat(i)
  return(1)
}

When I call

5条回答
  •  轮回少年
    2020-12-16 15:36

    On Linux, you can use a sink() call to /dev/null(or to a temporary file on another OS, see ?tempfile) :

    sink(file="/dev/null")
    f()
    sink()
    

提交回复
热议问题