R/cranology.R

Defines functions cranology

Documented in cranology

# Generated by fusen: do not edit by hand

#' Get number of packages on CRAN at a given date
#' 
#' Query MRAN to Get number of packages on CRAN at a given date.
#' MRAN -> Microsoft snapshots of CRAN.
#'
#' @param date A character string representing a date of the form yyyy-mm-dd.
#'
#' @return A data.frame with 2 columns `date` and `n` the number of packages on CRAN
#' at that date.
#' 
#' @export
#' @importFrom utils available.packages 
#' 
#' @examples
#' cranology("2020-03-15")
cranology <- function(date) {
  data.frame(
    date = date,
    n = nrow(
      available.packages(
        repos = sprintf("https://mran.microsoft.com/snapshot/%s", date)
      )
    )
  )
}
ALanguillaume/cranology documentation built on April 21, 2022, 12:32 a.m.