From whuber at embl.de  Sun May 30 14:49:00 2010
From: whuber at embl.de (Wolfgang Huber)
Date: Sun, 30 May 2010 14:49:00 +0200
Subject: [Rd] require( "foo (>= 2.1)" )
In-Reply-To: <4BFFFCA2.60201@r-enthusiasts.com>
References: <4BFFFCA2.60201@r-enthusiasts.com>
Message-ID: <4C025EBC.804@embl.de>

Hi Romain,

not that I have any authority here, but wouldn't your suggestion (which 
I think could be very useful) be more powerful if it were accompanied by 
a patch that could be applied to the R sources?

Best wishes
Wolfgang Huber
EMBL
http://www.embl.de/research/units/genome_biology/huber




On 28/05/10 19:25, Romain Francois wrote:
> Hello,
>
> I often find myself writing code like :
>
> if( require( "foo" ) && compareVersion( packageDescription(
> "foo")[["Version"]], "2.1" ) < 0 ){
>
> # code that uses version 2.1 of foo
> } else {
> stop( "could not load version >= 2.1 of foo" )
> }
>
>
>
> Would it make sense to include something like this in require, library,
> etc ...
>
> require( "foo (>= 2.1)" )
> require( "foo", minimal.version = "2.1" )
>
> I know we can use Depends: foo (>= 2.1) in a package DESCRIPTION file,
> but that does not work for loose dependencies, when package "bar" works
> better with "foo" but can still work fine without, or when not making a
> package.
>
> Romain
>

--



[Rd] require( "foo (>= 2.1)" )
Wolfgang Huber