Re: [Rd] optional package dependency

From: Thomas Lumley <>
Date: Fri, 15 Jan 2010 08:15:59 -0800 (PST)

On Fri, 15 Jan 2010, Seth Falcon wrote:

> There is a real need (of some kind) here. Not all packages work on all
> platforms. For example, the multicore package provides a mechanism for
> running parallel computations on a multi-cpu box, but it is not
> available on Windows. A package that _is_ available on all platforms
> should be able to optionally make use of multicore on non-Windows. I
> don't think there is a way to do that now and pass check without
> resorting to "tricks" as above. These tricks are bad as they make it
> harder to programmatically determine the true "suggests".
> And NAMESPACE brings up another issue in that being able to do
> conditional imports would be very useful for these cases, otherwise you
> simply can't make proper use of name spaces for any optional functionality.
> I'm willing to help work on and test a solution if we can arrive at some
> consensus as to what the solution looks like.


In the case of multicore it seems to work to put it in 'Suggests' and to use require() to load it. That's what I did with the survey package, and it didn't cause problems on CRAN. I didn't run CMD check on Windows myself, only on Mac and Linux.

A more difficult issue is providing methods for a generic in another package that might not be available. I wanted to provide methods on survey objects for generics in odfWeave, and I couldn't find out how to do that without making it required. I ended up creating a new odfWeave.survey package that depends on odfWeave and survey, but this seems like the sort of thing that should be able to be done with Enhances or Suggests.


Thomas Lumley			Assoc. Professor, Biostatistics	University of Washington, Seattle

______________________________________________ mailing list Received on Fri 15 Jan 2010 - 16:25:09 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 15 Jan 2010 - 17:40:14 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive