generated from fhdsl/metricminer-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcran.Rmd
73 lines (56 loc) · 2.71 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
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
---
title: "CRAN"
output:
html_document:
toc: true
toc_float: true
toc_collapsed: true
date: "`r format(Sys.time(), '%d %B, %Y')`"
---
## Preview
```{r, echo = FALSE, hide = TRUE, message = 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"))
## For google
# cran <- googlesheets4::read_sheet(yaml$cran_googlesheet)
```
Total CRAN downloads for all packages:
```{r}
cran %>% dplyr::summarize(download_total = sum(count))
```
CRAN package downloads over time, summarized by month.
```{r, 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")
```
## Setting up CRAN
In the `_config_automation.yml` you will need to specify a few things.
```
###### CRAN ######
refresh-cran: yes
cran_packages: [ metricminer, ottrpal ]
cran_googlesheet:
```
- [ ] In the `config_automation.yml` file, make sure that `refresh-cran` is set to "yes".
- [ ] In the `cran_packages` of your `config_automation.yml`, type the names of the packages that you'd like to collect data from on CRAN. Type them exactly as they are spelled, case sensitive, separated by commas. Delete the example package names we've put there.
- [ ] Optionally, if you are saving data to google, specify a googlesheet ID in `cran_googlesheet` you'd like the CRAN data to be saved to. This will only be relevant if you've set `data_dest` to `google`.
## Customizing CRAN Data
In order to customize the data you are downloading from CRAN you can modify the
`refresh-scripts/refresh-cran.R` script in your repository.
You can take a look at the [`metricminer` R package documentation](https://hutchdatascience.org/metricminer/articles/getting-started.html) for more details about the functions and what is possible.
If you have a metric need that is not currently fulfilled by `metricminer` or `metricminer-dashboard` we encourage you to [file a GitHub issue with us and let us know about your new feature idea (or bug report)](https://github.com/fhdsl/metricminer/issues/new/choose).