Liaw, Andy
2006-Apr-13 15:14 UTC
[Rd] Wishlist: 'quietly' argument for .onAttach() / .First.li b()
From: Prof Brian Ripley> > On Thu, 13 Apr 2006, Peter Ruckdeschel wrote: > > > Hi R-devels, > > > > in "Writing R extensions" as well as in the help > > to .onAttach(), you mention that one could > > use this function to issue a start-up message/banner > > for the package. > > > > My little wish for Easter: > > > > a 'quietly'-type argument for .onAttach() / .First.lib() which is > > passed through by functions > > require() and library() respectively, > > and by means of which one could optionally > > suppress this start-up message/banner . > > > > Is this hard to do? > > I believe so (and think we have been here before). The > documented call > sequence is > > .onLoad(libname, pkgname) > .onAttach(libname, pkgname) > > the same as .First.lib. There is no way to add an argument > here, as many > existing packages do not support it. Beyond that, how would > you pass the > argument in? Namespaces and packages are often > loaded/attached implicitly > as a result of loading other packages. > > I did think you could make use of an option to decide whether > to the print > the message or not, but I have always assumed that those who > did want a > banner probably did not want it suppressed.That certainly is the case with randomForest, speaking for myself here. The banner I put in contains the version number of the package and a reminder to see what's been changed/fixed. I have not seen a compelling reason why suppressing such information is necessary (as opposed to "desirable"). I believe reporting version number upon startup is a Good Thing, as all too often people ask questions or report problems about packages without mentioning the version of the packages they used. I see this as a way of reminding the users. Andy> -- > 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 > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > >
Liaw, Andy
2006-Apr-13 19:41 UTC
[Rd] Wishlist: 'quietly' argument for .onAttach() / .First.li b()
From: Bill Dunlap> > On Thu, 13 Apr 2006, Prof Brian Ripley wrote: > > > On Thu, 13 Apr 2006, Peter Ruckdeschel wrote: > > > > > Hi R-devels, > > > > > > in "Writing R extensions" as well as in the help > > > to .onAttach(), you mention that one could > > > use this function to issue a start-up message/banner > > > for the package. > > > > > > My little wish for Easter: > > > > > > a 'quietly'-type argument for .onAttach() / .First.lib() which is > > > passed through by functions > > > require() and library() respectively, > > > and by means of which one could optionally > > > suppress this start-up message/banner . > > > > > > Is this hard to do? > > > > I believe so (and think we have been here before). The documented > > call sequence is > > > > .onLoad(libname, pkgname) > > .onAttach(libname, pkgname) > > > > the same as .First.lib. There is no way to add an argument > here, as > > many existing packages do not support it. Beyond that, how > would you > > pass the argument in? Namespaces and packages are often > > loaded/attached implicitly as a result of loading other packages. > > > > I did think you could make use of an option to decide > whether to the > > print the message or not, but I have always assumed that > those who did > > want a banner probably did not want it suppressed. > > If the .onAttach() used message() instead of cat() > to display the banner message then you could use > suppressMessages(require("randomForest")) > to squelch the message.Thanks! This looks like a good alternative. What do others think of this approach? Andy> -------------------------------------------------------------- > -------------- > Bill Dunlap > Insightful Corporation > bill at insightful dot com > 360-428-8146 > > "All statements in this message represent the opinions of > the author and do not necessarily reflect Insightful > Corporation policy or position." > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > >
Seemingly Similar Threads
- Wishlist: 'quietly' argument for .onAttach() / .First.lib()
- Class not found when search in .onLoad
- Installing bioconduction packages in connection with loading an R package
- Problem with "setMethod" in R package
- what is the preferred method to create a package local variable?