-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathREADME.Rmd
108 lines (77 loc) · 3.19 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
---
output:
github_document:
html_preview: false
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, setup, echo = FALSE, message = FALSE}
knitr::opts_chunk$set(
comment = "#>",
tidy = FALSE,
error = FALSE)
```
# cranlogs <a href='https://r-hub.github.io/cranlogs'><img src='man/figures/logo.png' align="right" height="138.5" /></a>
> Download logs from the RStudio CRAN mirror
<!-- badges: start -->
[](https://travis-ci.org/r-hub/cranlogs)
[](https://ci.appveyor.com/project/gaborcsardi/cranlogs)
[](http://www.r-pkg.org/pkg/cranlogs)
[](http://www.r-pkg.org/pkg/cranlogs)
[](https://cranchecks.info/pkgs/cranlogs)
[](https://www.repostatus.org/#active)
[](https://gitter.im/r-hub/community)
<!-- badges: end -->
[RStudio](http://www.rstudio.com) 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](https://github.com/r-hub/cranlogs.app#the-api-of-the-cran-downloads-database) 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:
```r
install.packages("cranlogs")
```
Or get the development version from Github:
```{r eval = FALSE}
# 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.
```{r}
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:
```{r}
cran_downloads(when = "last-week")
```
The `package` argument queries a specific package:
```{r}
cran_downloads(when = "last-week", package = c("magrittr", "dplyr"))
```
Alternative intervals can also be specified:
```{r}
cran_downloads(package = "plyr", from = "2014-01-01", to = "2014-02-01")
```
For downloads of R itself, give `"R"` instead of a package:
```{r}
cran_downloads("R")
```
## Top downloaded packages
Last day for which data is available:
```{r}
cran_top_downloads()
```
Last week (6 days prior to the last day for which data is available):
```{r}
cran_top_downloads("last-week")
```
## Raw JSON API
See [the GitHub repo of the API of the CRAN downloads
database](https://github.com/r-hub/cranlogs.app).