[Rd] Conditional suggest (was Re: Enhances, require() and quality control)

Gregor Gorjanc gregor.gorjanc at bfro.uni-lj.si
Tue Dec 12 21:50:41 CET 2006


Kurt Hornik wrote:
>>>>>> Gregor Gorjanc writes:
...
>> I might have understood Enhances field wrongly but imagine this
>> situation. I have a package A and if I can use package B I would like to
>> use it otherwise try with "my own" solution. I thought that Enhances
>> fields is exactly for such situation. How should I check if package B is
>> available? I used
> 
>> if(require(B)) {
>>   someSuperDuperFuncFromPkgB()
>> } else {
>>   myOwnStuff()
>> }
> 
>> But R CMD check complains.
> 
>> I have encountered this with R2WinBUGS. This package helps calling
>> WinBUGS from R. It can also use OpenBUGS via BRugs, but BRugs is
>> available only for Windows. Therefore, one can not do any QC under
>> Linux. I thought to provide ability to call OpenBUGS via the same way
>> WinBUGS is called and then to put BRugs in Enhances field. But R CMD
>> check complained about use of require() for a package that is in
>> Enhanced field.
> 
> This is not "enhancing" the way it is currently implemented, which is
> allowing for the possibility to provide S3 or S4 methods for classes
> from another package without actively suggesting it (thus enhancing
> it).  What you describe seems to be a need for conditionally suggesting
> packages, e.g. if it is known that these are only available on certain
> platforms.  I don't think this is currently possible.

OK. Is there some way to test which package is being used i.e. the
"standard" or enhanced one? Or to paraphrase this differently. Are there
any proposals how "conditional suggest" could be done?

Thanks!

Gregor



More information about the R-devel mailing list