knitr::opts_chunk$set(
  comment = "#>",
  tidy = FALSE,
  error = FALSE)

cranlogs

Download logs from the RStudio CRAN mirror

Linux Build Status Windows Build status CRAN version CRAN RStudio mirror downloads cran checks Project Status: Active – The project has reached a stable, usable state and is being actively developed. Gitter chat

RStudio publishes the download logs from their CRAN package mirror daily at http://cran-logs.rstudio.com.

This R package queries a web API maintained by R-hub serving a database, also maintained by R-hub, that contains the daily download numbers for each package.

The RStudio CRAN mirror is not the only CRAN mirror, but it's a popular one: it's the default choice for RStudio users. The actual number of downloads over all CRAN mirrors is unknown.

Installation

You can install cranlogs from CRAN:

install.packages("cranlogs")

Or get the development version from Github:

# install.packages("remotes")
remotes::install_github("r-hub/cranlogs")

Usage

It has a very simple API. By default it shows the total number of package downloads from the last day for which data is available.

library(cranlogs)
cran_downloads()

The last week (6 days prior to the last day for which data is available), or the last month (29 days prior to the last day for which data is available) can be also easily queried:

cran_downloads(when = "last-week")

The package argument queries a specific package:

cran_downloads(when = "last-week", package = c("magrittr", "dplyr"))

Alternative intervals can also be specified:

cran_downloads(package = "plyr", from = "2014-01-01", to = "2014-02-01")

For downloads of R itself, give "R" instead of a package:

cran_downloads("R")

Top downloaded packages

Last day for which data is available:

cran_top_downloads()

Last week (6 days prior to the last day for which data is available):

cran_top_downloads("last-week")

Raw JSON API

See the GitHub repo of the API of the CRAN downloads database.



metacran/cranlogs documentation built on Nov. 30, 2020, 8:13 a.m.