Count number of R packages on CRAN each month for past 20 years or so

For fun, I would like to count the number of R packages on CRAN each month for the last 20 years or so (I believe CRAN originated in 1997).
I know the Microsoft have been taking daily snapshots of CRAN since Sept 2014. This allows me to do the following for example:

library(tidyverse)
library(lubridate)

# Get a sequences of dates in steps of one month
# from Sept 17, 2014 to today
date_sequence <- seq(from = ymd("2014-09-17"), 
                     to = today(), 
                     by='months')

# function to count packages on cran
# on a given date
count_cran_packages <- function(snapshot_date){
  repo <- sprintf(
    'https://cran.microsoft.com/snapshot/%s/',
    snapshot_date
  )
  available.packages(repos = repo) %>% 
    nrow()
}


# count packages on cran on each day in sequence
npackages_df <- tibble(date = date_sequence,
                       n = map_dbl(date, count_cran_packages)
) %>% 
  # counts of 0 occur due to errors, so zap them
  filter(n > 0)

That's great, and just what I want. However, this only goes back as far as September, 2014. I would like to go back as far as possible.

Does anyone know of any other way, of getting the number of packages available on CRAN every month for the past 20 years, or at least further back than 2014?

Wayback Machine goes back to 2000, so you can try something like that - https://web.archive.org/web/20001109094600/https://cran.r-project.org/

There is even this package that might help you - https://rdrr.io/github/hrbrmstr/wayback/

1 Like

Thanks. I think turning to the wayback machine is probably called for. The package you mentioned looks very useful, though so far I am sure how to use it to get all the information that I can otherwise get from browsing the wayback machine webpages. However, that's another matter.

In addition to this, I did find out that the CRANpackages data set in the Ecdat package has (partial and incomplete, I think, though have not looked yet) record of CRAN package info prior to 2009.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.