It uses an XML package. This is simply an account of archived versions (more precisely, the number of archived tar.gz files). Add 1 to get the total number of versions, including the current one.
nCRANArchived <- function(pkg) { link <- paste0("http://cran.r-project.org/src/contrib/Archive/", pkg) qry <- XML::getHTMLLinks(link, xpQuery = "//@href[contains(., 'tar.gz')]") length(qry) } nCRANArchived("data.table") # [1] 33 nCRANArchived("ggplot2") # [1] 28 nCRANArchived("MASS") # [1] 40 nCRANArchived("retrosheet") ## shameless plug # [1] 2
source share