Saiwing Yeung
2011-Dec-21 23:36 UTC
[R] Is there a way force hiding of all messages when calling library()?
For example, if I call "library(spam)", I would get messages like this Package 'spam' is loaded. Spam version 0.27-0 (2011-08-17). Type demo( spam) for some demos, help( Spam) for an overview of this package. Help for individual functions is optained by adding the suffix '.spam' to the function name, e.g. 'help(chol.spam)'. Attaching package: ?spam? The following object(s) are masked from ?package:base?: backsolve, forwardsolve, norm While I understand that it's helpful to see these message at times, most of the time I already knew these information, especially when I run things from a script. The bigger problem is that it clutters up the output and makes it harder to notice if there are real problems. I have tried "library(spam, warn.conflicts=T, quietly=F, verbose=F)" but it didn't help at all. Are there other ways to hide these messages? Thank you.
Hadley Wickham
2011-Dec-21 23:39 UTC
[R] Is there a way force hiding of all messages when calling library()?
You should be able to suppress them with suppressPackageStartupMessages() but not all packages produce startup messages in the approved manner. Hadley On Wed, Dec 21, 2011 at 5:36 PM, Saiwing Yeung <saiwing at berkeley.edu> wrote:> For example, if I call "library(spam)", I would get messages like this > > Package 'spam' is loaded. Spam version 0.27-0 (2011-08-17). > Type demo( spam) for some demos, help( Spam) for an overview > of this package. > Help for individual functions is optained by adding the > suffix '.spam' to the function name, e.g. 'help(chol.spam)'. > > Attaching package: ?spam? > > The following object(s) are masked from ?package:base?: > > ? ?backsolve, forwardsolve, norm > > > While I understand that it's helpful to see these message at times, most of the time I already knew these information, especially when I run things from a script. The bigger problem is that it clutters up the output and makes it harder to notice if there are real problems. I have tried "library(spam, warn.conflicts=T, quietly=F, verbose=F)" but it didn't help at all. Are there other ways to hide these messages? Thank you. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/