/
summary.Rmd
106 lines (80 loc) · 2.06 KB
/
summary.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
---
title: "rostats summary"
author: "rOpenSci Leadership Team"
date: "`r format(Sys.time(), '%d %B, %Y')`"
output: md_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(
echo = TRUE,
comment = "#>",
collapse = TRUE,
warning = FALSE,
message = FALSE,
fig.width = 10,
fig.height = 8
)
```
```{r echo=FALSE}
library("rostats")
```
## Get data
If you haven't downloaded data yet, get data:
Get Github commits
```{r eval=FALSE}
pkgs <- ropensci_pkgs()
gather_commits(pkgs$owner_repo)
```
Get CRAN downloads
```{r eval=FALSE}
pkgs <- ropensci_pkgs(TRUE)$name
gather_downloads(x = pkgs)
```
These both download to directories in `rappdirs::user_cache_dir("rostats")`
For the below plotting functions, you can pass a particular file name, just the
base name, not full path, or leave it as `NULL` and it uses file with the
most recent date
## Code contributions
Git commit history
```{r}
cum_commits()
```
## Contributors
Cumulative number of contributors
```{r}
cum_contribs()
```
## New packages on CRAN
These represent stable/mature enough packages to be delivered to the world.
```{r}
library("dplyr")
library("ggplot2")
pkgs <- ropensci_pkgs(TRUE)$name
res <- gather_crans(pkgs)
alldat <- bind_rows(res)
dates <- cran_first_date(alldat)
# exclude geonames, was created before ropensci existed
dates <- dates %>% filter(pkg != "geonames")
# summarise
dat <- dates %>%
group_by(date) %>%
summarise(count = n()) %>%
mutate(cumsum = cumsum(count))
ggplot(dat, aes(date, cumsum)) +
geom_line(size = 2) +
theme_bw(base_size = 18) +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "none",
axis.ticks.x = element_blank(),
panel.border = element_rect(size = 2)) +
labs(y = 'Cumulative New Packages on CRAN')
```
## Package Downloads
Via CRAN downloads stats collected from just one of the CRAN mirrors
at [https://cran.rstudio.com](https://cran.rstudio.com)
```{r}
library("ggplot2")
cum_downloads() %+%
facet_wrap(~package, scales = "free_y", ncol = 2)
```