[Rd] Depending/Importing data only packages

Paul Gilbert pgilbert902 at gmail.com
Sun Dec 8 05:15:49 CET 2013



On 13-12-07 05:21 PM, Hadley Wickham wrote:
>> The Writing R Extensions manual says that Suggests is for packages which
>> are required only for examples, which I believe matches Hadley's original
>> question.
>
> Yes, but without this package they won't be able to run the majority
> of examples, which I think delivers a poor experience to the user. It
> also means I have to litter my examples with if(require("x")),

I think you just need require("x") or library("x"). If it is in Suggests 
then it is available whenever examples are tested, so you don't need the 
if(). In my opinion, this increases the signal by indicating to the 
reader where the data comes from.

> decreasing the signal to noise ratio in the examples.
>
> But we're getting a bit far from my original question about the NOTE:
>
>    Package in Depends field not imported from: 'hflights'
>    These packages needs to imported from for the case when
>    this namespace is loaded but not attached.
>
> Depending on (or linking to) a package is not just about making the
> functions in the package available.

Several of us used to think that, but the modern interpretation seems to 
be just about making things in the package yours depends on available to 
users of your package. "Exports:" might be a better term than 
"Depends:", at least if Depends: was not trying to mean both Imports: 
and Exports:".

Paul
>
> Hadley
>



More information about the R-devel mailing list