当我需要图书馆时,不要显示输出

时间:2014-08-09 05:43:59

标签: r

当我需要一个库时,我不希望它附带所有额外的输出。我怎么能关掉这个?

有输出(坏):

> require('forecast')
Loading required package: forecast
Loading required package: zoo

Attaching package: ‘zoo’

The following objects are masked from ‘package:base’:

    as.Date, as.Date.numeric

Loading required package: timeDate
This is forecast 5.4 
>

没有输出(好):

> require('forecast')
>

1 个答案:

答案 0 :(得分:3)

您可以使用require包裹library(和/或suppressMessages),

suppressMessages(require(forecast))

并且加载时不会显示消息。