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

Kurt Hornik wrote:
>>>>>> Gregor Gorjanc writes:
> 
>> Hello!
> 
>> I am working on a package where Enhances field seems to be a plausible
>> option. When I add package, say coda, to this field, I get the
>> following warning with recent R-devel:
> 
>> ----
> 
>> * checking for working latex ... OK
>> * using log directory '/home/ggorjan/programs/R/devel/test.Rcheck'
>> * using R version 2.5.0 Under development (unstable) (2006-12-06 r40129)
>> * checking for file 'test/DESCRIPTION' ... OK
>> * this is package 'test' version '0.1'
>> * checking package dependencies ... WARNING
>> 'library' or 'require' calls not declared from:
>>   coda
> 
>> See the information on DESCRIPTION files in the chapter 'Creating R
>> packages' of the 'Writing R Extensions' manual.
> 
> Why would you think that Enhances: is right here?
> 
> If you use library or require on a package, you do more than enhance it,
> and the package should be listed in Depends or Suggests.

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.

Thanks!

Gregor



[Rd] Enhances, require() and quality control
Gregor Gorjanc