[Rd] declaring package dependencies

Michael Friendly friendly at yorku.ca
Fri Sep 13 14:31:55 CEST 2013


On 9/12/2013 1:37 PM, Duncan Murdoch wrote:
>
> I think this one would be fine if you had library(MASS) or 
> require(MASS) or (probably best) used MASS::loglm explicitly.  It may 
> be that in the past some other package put MASS on the search list, 
> and that's why it worked before.
>
> The distinction is between "loading" and "attaching" a package. 
> Loading it (which would be done if you had MASS::loglm, or imported 
> it) guarantees that the package is initialized and in memory, but 
> doesn't make it visible to the user without the explicit MASS:: 
> prefix.  Attaching it first loads it, then modifies the user's search 
> list so the user can see it.
>
> Loading is less intrusive, so it's preferred over attaching.  Both 
> library() and require() would attach it.
>
Thanks for this explanation, but I'm still confused about how to avoid 
the wrath of the CRAN-devel
daemon, whose appetite for new morsels of developer flesh seems ever 
increasing and makes
keeping even a stable package up-to-date a moving target.  Perhaps such 
changes in R devel
should be announced on this list for public comment before they are 
enforced in R CMD check.

In vcdExtra, I use MASS::loglm in ~ 6 .Rd examples, a vignette, and also 
provide R code that
extends *.loglm methods.  All of this previously worked by including 
Suggests: MASS, ...
Changing this to Imports: MASS seems rather heavy-handed; I don't really 
want/need all of MASS
in my namespace, and using MASS::loglm in examples seems ugly.  For now, 
I'll use
require(MASS) in each example.

> Attaching it first loads it, then modifies the user's search list so 
> the user can see it. 
Which directive does this?

-- 
Michael Friendly     Email: friendly AT yorku DOT ca
Professor, Psychology Dept. & Chair, Quantitative Methods
York University      Voice: 416 736-2100 x66249 Fax: 416 736-5814
4700 Keele Street    Web:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA



More information about the R-devel mailing list