From gregor.gorjanc at bfro.uni-lj.si  Tue Dec 12 21:50:41 2006
From: gregor.gorjanc at bfro.uni-lj.si (Gregor Gorjanc)
Date: Tue, 12 Dec 2006 21:50:41 +0100
Subject: [Rd] Conditional suggest (was Re:  Enhances,
 require() and quality control)
In-Reply-To: <17791.3473.773533.683137@mithrandir.hornik.net>
References: <4577626C.7020504@bfro.uni-lj.si>	<17785.51000.419093.552316@mithrandir.hornik.net>	<457E661D.5070009@bfro.uni-lj.si>
	<17791.3473.773533.683137@mithrandir.hornik.net>
Message-ID: <457F1621.2080304@bfro.uni-lj.si>

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



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