Skip to content

Instantly share code, notes, and snippets.

@yihui
Created February 9, 2011 04:25
Show Gist options
  • Save yihui/817877 to your computer and use it in GitHub Desktop.
Save yihui/817877 to your computer and use it in GitHub Desktop.
check the version of R on CRAN
x = readLines("http://cran.r-project.org/sources.html")
# the version number is in the next line of 'The latest release'
rls = x[grep("latest release", x) + 1L]
newver = gsub("(.*R-|\\.tar\\.gz.*)", "", rls)
oldver = paste(getRversion(), collapse = ".")
# new version available?
compareVersion(newver, oldver) == 1L
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment