generated from fhdsl/metricminer-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcran.Rmd
45 lines (37 loc) · 1.33 KB
/
cran.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
---
title: "OCSdata Package Downloads from CRAN"
output:
html_document:
toc: true
toc_float: true
toc_collapsed: true
date: "`r format(Sys.time(), '%d %B, %Y')`"
---
```{r, echo = FALSE, hide = TRUE, message = FALSE, warning=FALSE}
library(tidyverse)
root_dir <- rprojroot::find_root(rprojroot::has_dir(".git"))
yaml <- yaml::read_yaml(file.path(root_dir, "_config_automation.yml"))
## For github
cran <- readr::read_tsv(file.path("metricminer_data", "cran", "cran.tsv"))
```
### Downloads over time
```{r, echo = FALSE, message = FALSE}
cran_stats <- cran %>%
separate(date, into=c("year", "month name", "day"), sep = "-") %>%
unite("Month", c("year", "month name"), sep='-', remove=TRUE) %>%
group_by(Month, package) %>%
summarise(monthly_downloads = sum(count)) %>% #summarize monthly downloads by package
filter(monthly_downloads > 0) #drop the 0's
ggplot(cran_stats, aes(Month, monthly_downloads, group=package, color = package)) +
geom_line() +
geom_point() +
theme(panel.background = element_blank(), panel.grid = element_blank()) +
theme(axis.text.x = element_text(angle = 90)) +
labs(x = NULL,
y = "Monthly Downloads",
color = "R Packages")
```
### Total downloads
```{r echo=FALSE, results = 'asis'}
cat(unlist(cran %>% dplyr::summarize(download_total = sum(count)), use.names = FALSE))
```