Tyler Rinker
Tyler Rinker

Reputation: 109844

Programatically get latest stable R release version number

How can I use R to get the most recent release of R? I know about the gtools::checkRVersion but was hoping for a base solution, even better one that doesn't rely on scraping/regex.

The desired result as of today (2015-06-13) would be: 3.2.0

Upvotes: 4

Views: 228

Answers (3)

Joshua Ulrich
Joshua Ulrich

Reputation: 176638

Another potential alternative: CRAN has a dcf file with version information. I'm not sure how reliably it is updated though.

R> tmp <- tempfile()
R> download.file("http://cran.r-project.org/src/base/VERSION-INFO.dcf", tmp)
R> (x <- read.dcf(tmp))
     Release Old-release Devel  
[1,] "3.2.0" "3.1.3"     "3.3.0"

Upvotes: 5

Dirk is no longer here
Dirk is no longer here

Reputation: 368181

There is a new-ish package rversions by Gabor which wraps the service even more easily:

R> library(rversions)
R> r_release()
   version                        date
94   3.2.0 2015-04-16T07:13:33.144514Z
R> 
R> r_release()[[1]]
[1] "3.2.0"
R> 

If you have devtools installed, you probably already have rversions too.

The package has two more functions to get

  • the previous release via r_oldrel(), as well as
  • a vector of all releases via r_versions()

Upvotes: 4

agstudy
agstudy

Reputation: 121568

Using the METRCAN API (@Roland comment):

library(RJSONIO)
fromJSON("http://rversions.r-pkg.org/r-release")[[1]][['version']]
[1] "3.2.0"

Upvotes: 4

Related Questions