How to scrape the web for the list of R release dates?
r
Solution
Edited to include R version 3.0.0 and above
Dirk Eddelbuettel provided the canonical link to the .0 releases of R.
Here is some code that collates the tables from the three separate URLs, one for each major release, and then plot it:
library(XML)
library(lattice)
getRdates <- function(){
url <- paste0("http://cran.r-project.org/src/base/R-", 0:3)
x <- lapply(url, function(x)readHTMLTable(x, stringsAsFactors=FALSE)[[1]])
x <- do.call(rbind, x)
x <- x[grep("R-(.*)(\\.tar\\.gz|\\.tgz)", x$Name), c(-1, -5)]
x$Release <- gsub("(R-.*)\\.(tar\\.gz|tgz)", "\\1", x$Name)
x$Date <- as.POSIXct(x[["Last modified"]], format="%d-%b-%Y %H:%M")
x$Release <- reorder(x$Release, x$Date)
x
}
x <- getRdates()
dotplot(Release~Date, data=x)
Problem
To celebrate the 20,000th question with the r-tag on Stack Overflow, please help me to extract the R release dates from the Wikipedia page. My attempts: ``` library(XML) x <- readHTMLTable("http://en.wikipedia.org/wiki/R_(programming_language)") ``` This doesn't work because the table is in fact a list, not an HTML table. ``` library(httr) x <- GET("http://en.wikipedia.org/wiki/R_(programming_language)") text <- content(x, "parsed") ``` This extracts the text, but my `xpath` is rusty, so I couldn't extract the relevant release dates. How can I do this? PS. The Wikipedia page is the only source I could find, but please feel free to post a solution using canonical source, if there is one.