SUMMARY: Best way to check/assert a certain version of [R] or a package

Henrik Bengtsson hb at maths.lth.se
Fri Jan 25 14:43:03 CET 2002


Thanks for all you replies here. Here is a short summary how to solve the
two problems discussed:

1) Check for correct version of [R]

  current <- paste(R.Version()[c("major", "minor")], collapse=".")
  wanted <- "1.4.0"
  tooOld <- (compareVersion(current, wanted) < 0)

2) Check for correct version of a package

  package <- "eda"
  current <- package.description(package)["Version"]
  wanted <- "1.3.1"
  tooOld <- (compareVersion(current, wanted) < 0)

It could be questioned if compareVersion("1.4.0", "1.4") should give 1
and not 0, but hopefully that is not an real issue.

PS. packageStatus() seems promising. DS.

Have nice day!

Henrik Bengtsson

Dept. of Mathematical Statistics @ Centre for Mathematical Sciences 
Lund Institute of Technology/Lund University, Sweden (+2h UTC)
Office: P316, +46 46 222 9611 (phone), +46 46 222 4623 (fax)
h b @ m a t h s . l t h . s e
http://www.maths.lth.se/matstat/staff/hb/



On Fri, 25 Jan 2002, Prof Brian Ripley wrote:

> On Fri, 25 Jan 2002, Henrik Bengtsson wrote:
> 
> [...]
> 
> > What is the easiest way to retrieve the version string of a certain package.
> > Should one find the path to the package, then load the DESCRIPTION file and
> > parse it?
> 
> Take a look at packageStatus, which uses package.description and
> compareVersion.  package.dependencies can be used to test the R version
> at present, at least.
> 
> -- 
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272860 (secr)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
> 
> 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list