I would like to turn off all the messages during library(aPackage) or require(aPackage) I tried different commands: invisible, capture.output, sink but none of them is working. For example, loading VGAM, gives a lot of unnecessary messages:> library(VGAM)Attaching package: 'VGAM' The following object(s) are masked from package:splines : bs The following object(s) are masked from package:splines : ns The following object(s) are masked from package:boot : logit The following object(s) are masked from package:boot : simplex The following object(s) are masked from package:stats : glm The following object(s) are masked from package:stats : lm The following object(s) are masked from package:stats : poly The following object(s) are masked from package:stats : predict.glm The following object(s) are masked from package:stats : predict.lm The following object(s) are masked from package:stats : predict.mlm The following object(s) are masked from package:base : scale.default Any hint/help will be appreciated. --------------------------------- Expecting? Get great news right away with email Auto-Check. [[alternative HTML version deleted]]
Try this. We first load the dependent packages to avoid the loading message: library(splines) library(stats4) library(VGAM, warn.conflicts = FALSE) On 1/30/07, johan Faux <johanfaux at yahoo.com> wrote:> I would like to turn off all the messages during > library(aPackage) or > require(aPackage) > > I tried different commands: invisible, capture.output, sink but none of them is working. > > For example, loading VGAM, gives a lot of unnecessary messages: > > > library(VGAM) > > Attaching package: 'VGAM' > > > The following object(s) are masked from package:splines : > > bs > > The following object(s) are masked from package:splines : > > ns > > > The following object(s) are masked from package:boot : > > logit > > The following object(s) are masked from package:boot : > > simplex > > > The following object(s) are masked from package:stats : > > glm > > The following object(s) are masked from package:stats : > > lm > > The following object(s) are masked from package:stats : > > poly > > The following object(s) are masked from package:stats : > > predict.glm > > The following object(s) are masked from package:stats : > > predict.lm > > The following object(s) are masked from package:stats : > > predict.mlm > > > The following object(s) are masked from package:base : > > scale.default > > > > Any hint/help will be appreciated. > > > > > --------------------------------- > Expecting? Get great news right away with email Auto-Check. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >
It depends on the 'message'. In this case> library(VGAM, warn.conflicts=FALSE) > suppressMessages(library(VGAM))both work. (How did you manage to miss the first?) In general, it depends on whether the 'message' is a message in the sense of message() or produced some other way. sink() would work, but these are *messages*, so how did you use it? On Tue, 30 Jan 2007, johan Faux wrote:> I would like to turn off all the messages during > library(aPackage) or > require(aPackage) > > I tried different commands: invisible, capture.output, sink but none of them is working. > > For example, loading VGAM, gives a lot of unnecessary messages: > >> library(VGAM) > > Attaching package: 'VGAM' > > > The following object(s) are masked from package:splines : > > bs > > The following object(s) are masked from package:splines : > > ns > > > The following object(s) are masked from package:boot : > > logit > > The following object(s) are masked from package:boot : > > simplex > > > The following object(s) are masked from package:stats : > > glm > > The following object(s) are masked from package:stats : > > lm > > The following object(s) are masked from package:stats : > > poly > > The following object(s) are masked from package:stats : > > predict.glm > > The following object(s) are masked from package:stats : > > predict.lm > > The following object(s) are masked from package:stats : > > predict.mlm > > > The following object(s) are masked from package:base : > > scale.default > > > > Any hint/help will be appreciated. > > > > > --------------------------------- > Expecting? Get great news right away with email Auto-Check. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Thank you for your help. It answers my question but I'm still unclear about something. I understand that suppressWarnings() will suppress warnings suppressMessanges() will suppress *messages* What other *messages* type are there and how to suppress all of them. For example, I want to quietly *install* a package:> install.packages("pkgDepTools",repos="http://bioconductor.org",lib="~/.R/library-i686")but I always get the following printed. How to suppress it ? trying URL 'http://bioconductor.org/src/contrib/pkgDepTools_1.0.1.tar.gz' Content type 'application/x-gzip' length 145394 bytes opened URL =================================================downloaded 141Kb * Installing *source* package 'pkgDepTools' ... ** R ** inst ** preparing package for lazy loading Loading required package: graph Loading required package: RBGL ** help >>> Building/Updating help pages for package 'pkgDepTools' Formats: text html latex example basicInstallOrder text html latex cleanPkgField text html latex getDownloadSize text html latex getInstallOrder text html latex makeDepGraph text html latex example makePkgUrl text html latex parseContentLength text html latex pkgDepTools-package text html latex ** building package indices ... * DONE (pkgDepTools) The downloaded packages are in /tmp/RtmpYl8LZA/downloaded_packages Warning message: cannot create HTML package index in: tools:::unix.packages.html(.Library)>Thank you again, -Johan ----- Original Message ---- From: Prof Brian Ripley <ripley@stats.ox.ac.uk> To: johan Faux <johanfaux@yahoo.com> Cc: r-help@stat.math.ethz.ch Sent: Tuesday, January 30, 2007 5:24:25 PM Subject: Re: [R] silent loading of packages It depends on the 'message'. In this case> library(VGAM, warn.conflicts=FALSE) > suppressMessages(library(VGAM))both work. (How did you manage to miss the first?) In general, it depends on whether the 'message' is a message in the sense of message() or produced some other way. sink() would work, but these are *messages*, so how did you use it? On Tue, 30 Jan 2007, johan Faux wrote:> I would like to turn off all the messages during > library(aPackage) or > require(aPackage) > > I tried different commands: invisible, capture.output, sink but none of them is working. > > For example, loading VGAM, gives a lot of unnecessary messages: > >> library(VGAM) > > Attaching package: 'VGAM' > > > The following object(s) are masked from package:splines : > > bs > > The following object(s) are masked from package:splines : > > ns > > > The following object(s) are masked from package:boot : > > logit > > The following object(s) are masked from package:boot : > > simplex > > > The following object(s) are masked from package:stats : > > glm > > The following object(s) are masked from package:stats : > > lm > > The following object(s) are masked from package:stats : > > poly > > The following object(s) are masked from package:stats : > > predict.glm > > The following object(s) are masked from package:stats : > > predict.lm > > The following object(s) are masked from package:stats : > > predict.mlm > > > The following object(s) are masked from package:base : > > scale.default > > > > Any hint/help will be appreciated. > > > > > --------------------------------- > Expecting? Get great news right away with email Auto-Check. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@stat.math.ethz.ch 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. >-- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ____________________________________________________________________________________ Never Miss an Email [[alternative HTML version deleted]]