Skip to content

[Bioc-devel] affypdnn: Request for moving "Depends" packages to "Suggests"

3 messages · Richard Pearson, Robert Gentleman, Henrik Bengtsson

#
Hi

I guess you mean require() here, or is there a request() function that I'm not aware of?

I'm sorry to say I'm still a little confused as to the effects of moving something from Depends to Suggests. I realise that one effect of this is that the package in Suggests won't get loaded until needed, which is generally a good thing. However, isn't a side effect of this that the package in Suggests won't get installed by biocLite()?

Lets say I'm developing a package foop which has a function foo(). foo() uses the function bar() from package barp. Many users use foop without ever using foo(). Therefore it would seem sensible to put barp in Suggests so it doesn't get loaded all the time, but rarely used. However, if a user installs foop on a fresh R installation using biocLite(), they will get an error when trying to use foo(). A non-expert user might at this point simply think that foop is broken and give up. What's the recommended strategy in this scenario? If barp has a namespace, should I put barp in Imports (so it gets installed by biocLite), and then access bar() using barp::bar()? What should I do if barp has no namespace? Should I recommend to the barp maintainer that they add one? More likely, have I completely misunderstood Depends/Suggests/Imports/biocLite...?

No doubt this is covered in documentation someplace, any pointers appreciated!

Thanks

Richard.
Henrik Bengtsson wrote:

  
    
#
Hi Richard,
Richard Pearson wrote:
Yes, and so it should only be used if the functionality is for fairly 
specialized tasks that are not likely to be carried out by all users. 
The network of Dependencies can get very large, and the number of 
packages a user has to install that they never use should be minimized 
if possible (whence the Lite in biocLite).

  However, a review of Suggests, Depends, and package size is something 
that package developers should be carrying out regularly.  There are 
some examples where the need for dependencies has essentially gone away 
but the package has never been cleaned up to reflect that. Or where 
Dependencies would be better handled via imports.
One certainly hopes that even naive users could see and interpret 
the corresponding error message. And you as the developer of foop could 
intervene directly, by either printing a specific warning, or as some 
have done (not always very well) automatically downloading the needed 
package at run time (possibly after asking the user).
There is also the issue that some packages Depend on foop, when indeed 
they really only want to Import from foop.  This is also something that 
could be cleaned up. Both Depends and Suggests have the effect of 
attaching the package to the searchpath and that can have unwanted 
effects.  Cleaning up a number of these instances would also help.

   For namespaces Luke Tierney's R News article is the only real 
reference I know of.  Other issues are discussed in the R Extensions 
manual, and on-line man pages.

   best wishes
     Robert

  
    
#
Hi,

my comment below on users not able to install missing packages.
On Tue, Jul 1, 2008 at 3:22 AM, Robert Gentleman <rgentlem at fhcrc.org> wrote:
I second this.

It would also not be hard to have library()/require() throw errors of
a specific class, say MissingPackageError, and then have an exception
handling that do what ever the user/developer prefers.  If such an
error reaches the "user/prompt", there could be user options() saying
what to do, e.g. today's error message is display, a prompt (text or
GUI) is display asking the user if s/he wants to download and install
the missing package, or install the package automatically, and then
continue.

/Henrik