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

Henrik Bengtsson hb at maths.lth.se
Fri Jan 25 00:52:41 CET 2002


When loading a package with library(APkg) or require(APkg) I would like to
make sure that (1) the correct version of [R] is installed. If not an
informative error message should be given. I would also like to make sure
that (2)  another required package which is loaded from within the APkg
package (by require(OtherPkg)) is of a certain version or later.

First of all, I believe that the check should be done in .First.lib(),
correct? To check for the correct version of [R] I would guess that
R.Version()$major and R.Version()$minor could be used to retrieve the
version. Is there any prewritten function to compare two version strings;
"1.2.1" is before "1.2.10"?
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?

Thanks a lot

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/


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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