CRAN download counts

API for CRAN package download counts, from the RStudio CRAN mirror.


Badges

Add a badge with download counts to your homepage or your Github project page. Our badges were generated by shields.io.

See the Github page for other badge styles.


R package

Query download counts directly from R with the cranlogs R package. You can install it from Github:

> devtools::install_github("metacran/cranlogs")
Then you can use it to query the CRAN logs server, and the results are returned in a data frame. You can also query multiple packages at once.
> cran_downloads(when = "last-week", packages = c("ggplot2", "httr"))
	
         date count package
1  2015-04-17  5245 ggplot2
2  2015-04-18  3688 ggplot2
3  2015-04-19  3989 ggplot2
4  2015-04-20  6865 ggplot2
5  2015-04-21  6523 ggplot2
6  2015-04-22  6767 ggplot2
7  2015-04-23  6346 ggplot2
8  2015-04-17  2024    httr
9  2015-04-18  1819    httr
10 2015-04-19  2025    httr
11 2015-04-20  2706    httr
12 2015-04-21  2457    httr
13 2015-04-22  2621    httr
14 2015-04-23  2286    httr

See more on its Github page.


JSON API

The server provides a JSON API through HTTP as well:

$ curl https://cranlogs.r-pkg.org/downloads/total/last-week/ggplot2
	  
[
  {
    start: "2015-04-17",
    end: "2015-04-23",
    downloads: 39423,
    package: "ggplot2"
  }
]
The details are documented on the Github page.