From romain at r-enthusiasts.com  Fri May 28 19:25:54 2010
From: romain at r-enthusiasts.com (Romain Francois)
Date: Fri, 28 May 2010 19:25:54 +0200
Subject: [Rd] require( "foo (>= 2.1)" )
Message-ID: <4BFFFCA2.60201@r-enthusiasts.com>

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

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://bit.ly/9CQ66r : RMetrics 2010
|- http://bit.ly/cork4b : highlight 0.1-8
`- http://bit.ly/bklUXt : RcppArmadillo 0.2.1





[Rd] require( "foo (>= 2.1)" )
Romain Francois