In R, one can figure out the version of a specific package, and use relational operators on it, with packageVersion()
. For example:
packageVersion("MASS")
(pp <- packageVersion("MASS"))
## [1] ‘7.3.43’
pp > '7.2.0'
## TRUE
How does one get the equivalent form of version information for the running copy of R itself?
To answer this, you have to figure out exactly where to look, which is not as easy as it seems: for example
grep("R[._vV]",apropos("version"),value=TRUE)
## [1] ".ess.ESSRversion" ".ess.Rversion" "getRversion"
## "R_system_version"
## [5] "R.Version" "R.version" "R.version.string"
I'm asking this because I'm frustrated at having to figure it out every few months ... I will answer if no-one else does. Extra credit for elucidating the difference between packageVersion()
and package_version()
...
I think this question is answered in passing here, but the focus of my question is specifically how to get the information in programmatic form (i.e., not just how to find out what version is running, but how to get it in a form suitable for running automated version tests within R).