[Rd] optional package dependency

Seth Falcon seth at userprimary.net
Sat Jan 16 16:49:10 CET 2010


On 1/15/10 7:47 AM, Simon Urbanek wrote:
> 
> On Jan 15, 2010, at 10:22 , Seth Falcon wrote:
>> I believe another option is:
>>
>>   pkg <- "somePkg"
>>   pkgAvail <- require(pkg, character.only = TRUE)
>>   if (pkgAvail)
>>      ...
>>   else
>>      ...
>>
> 
> That is not an option - that is the code you usually use with Suggests:
> (except for the pkg assignment which is there I presume to obscure things).

Unfortunately, it _is_ an option, just not a good one :-)

Some packages need to dynamically load other packages (think data
packages) and they will not know ahead of time what packages they will
load.  So there has to be some sort of loop-hole in the check logic.  In
legitimate cases, this is not obscuring anything.  In this case, I think
we agree the use would not be legitimate.

I'm less and less convinced that the force suggests behavior is useful
to anyone.  Package repositories can easily attempt to install all
suggests and so packages will get complete testing.  Package authors
should be responsible enough to test their codes with and without
optional features.  The slight convenience for an author to know that
optional packages are missing is at least equally balanced with the
slight inconvenience of having to change the check configuration in
order to test in the case of missing suggests.

Anyway...



More information about the R-devel mailing list