[Rd] Wishlist: 'quietly' argument for .onAttach() / .First.lib()

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Apr 13 18:25:55 CEST 2006


On Thu, 13 Apr 2006, Peter Ruckdeschel wrote:

> Andy Liaw wrote:
>> 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). /
> sorry, but I did not find anything on it ---
> probably I searched for the wrong keywords.
>> /> 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.
>> /
> Couldn't a reasonable default value (probably FALSE ) catch this?

No. The problem is the other way round: if we arrange to call 
.onLoad(libname, pkgname, quietly), MASS will throw an error about an 
unmatched argument in its .onLoad, and similarly for hundreds of packages.
It's an API change, one of a magnitude that we would only contemplate for
R 3.x.y.

>> /> Beyond that, how would / /you pass the
>> />/ argument in?  Namespaces and packages are often
>> />/ loaded/attached implicitly //as a result of loading other packages.
>> /
> oK this is an issue --- no idea for this.
>>> / I did think you could make use of an option to decide whether
>> />/ to the print //the message or not,
>> /
> This is probably the cleanest solution.
>> /> 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.
>>
> I completely agree as to package version information
> and pointers to NEWS / more information on the package.
>
> My wish is motivated by something else ---  call it
>
>           /"scalable start-up message"/
>
> In a discussion with Martin Maechler, he proposed to alert/warn
> the user in some prominent place about the interpretation of
> arithmetics operating on distributions in our package "distr".
>
> I have been thinking about this "prominent place" for some time
> and found that an .onAttach() message might be the right place.
>
> A user, however, who is already used to this interpretation, will soon
> find this (extended) start-up message annoying and will want to
> suppress it.
>
> I could do this with a "hand-made" option but thought this might
> be of more general interest.
>
> Thank you for your attention,
> Peter
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
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



More information about the R-devel mailing list