Closed AndreMikulec closed 3 years ago
Thanks for reporting this.
Greg,
If anyone cares, I have been using this new anonymous function in my Rprofile.site file. This function is based off of the code in gtools::checkRVersion. This new function is very nice.
if (interactive()) {
# gtools__checkRVersion
(function (quiet = FALSE) {
page2 <- scan(file = "https://cran.r-project.org/src/base/R-2",
what = "", quiet = TRUE)
page3 <- scan(file = "https://cran.r-project.org/src/base/R-3",
what = "", quiet = TRUE)
# NEW BY ANDRE
page4 <- scan(file = "https://cran.r-project.org/src/base/R-4",
what = "", quiet = TRUE)
combined <- c(page2, page3, page4)
matches <- grep("R-[0-9]\\.[0-9]+\\.[0-9]+", combined, value = TRUE)
versionList <- gsub("^.*R-([0-9].[0-9]+.[0-9]+).*$", "\\1",
matches)
versionList <- numeric_version(versionList)
banner <- function(Message, software = "Current") {
if(software == "Newer") {
writeLines("********************************************")
writeLines(" *** *** *** *** *** *** *** ")
writeLines("*** *** *** *** *** *** *** **")
}
writeLines("********************************************")
writeLines(Message)
writeLines(Message)
writeLines("********************************************")
if(software == "Newer") {
writeLines("*** *** *** *** *** *** *** **")
writeLines(" *** *** *** *** *** *** *** ")
writeLines("********************************************")
}
}
if (max(versionList) > getRversion()) {
if (!quiet) {
LATESTVERSION <- paste0("A newer version of R is now available: ", as.character(max(versionList)))
banner(LATESTVERSION, software = "Newer")
}
invisible(max(versionList))
}
else {
if (!quiet) {
LATESTVERSION <- paste0("The latest version of R is installed: ", as.character(max(versionList)))
banner(LATESTVERSION)
}
invisible(NULL)
}
})()
# OTHER STUFF
}
If a new version of R exists, output will be displayed like this:
********************************************
*** *** *** *** *** *** ***
*** *** *** *** *** *** *** **
********************************************
A newer version of R is now available: 4.0.3
A newer version of R is now available: 4.0.3
********************************************
*** *** *** *** *** *** *** **
*** *** *** *** *** *** ***
********************************************
I've just submitted gtools
3.9.0 to CRAN, which includes the fix to recognize R version 4 and later.
Gregory R. Warnes,
checkRVersion is not detecting R 4.0.0 (that has just been released.)
This new page exists.
The case may be to change from . . .
to . . .