-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
115 lines (80 loc) · 2.77 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
109
110
111
112
113
114
115
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# {cranology}: The CRAN Chronology
<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![R-CMD-check](https://github.com/ThinkR-open/cranology/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ThinkR-open/cranology/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
The goal of `{cranology}` is to provide tools to scrape data from CRAN and PPM websites as well
as useful datasets to explore the evolution of the number of packages on CRAN.
```{r, fig.retina=2}
cranology::plot_cran_monthly_package_number()
```
## Installation
You can install the development version of `{cranology}` with:
``` r
remotes::install_github("ThinkR-open/cranology")
```
## Examples
```{r example}
library(cranology)
```
### Datasets
All packages ever available on CRAN.
```{r}
cran_packages_history
```
The evolution of the number of packages on CRAN since its beginning.
```{r}
cran_monthly_package_number
```
### Scraping tools
#### CRAN
Both `cran_packages_history` and `cran_monthly_package_number` datasets are generated
by the function `scrape_cran()`. The scraping process is quite time consuming and
relies on the `{furrr}` package to scrape the CRAN pages asynchronously.
```{r, eval=FALSE}
future::plan(future::multisession)
scrape_cran_history()
```
#### PPM
`{cranology}` also includes the `get_package_number_ppm()` function to more quickly
get the number of packages that were available on CRAN at any given date.
```{r}
dates <- seq(
from = as.Date("2018-04-10", "%Y-%m-%d"),
by = "1 year",
length.out = 4
)
get_package_number_ppm(dates)
```
Be careful though as this will only work for dates posterior to `2014-09-17` the day when PPM
was up online for the first time.
```{r, error=TRUE}
get_package_number_ppm("2013-08-28")
```
For earlier dates use `cran_monthly_package_number`. Here is a naïve example:
```{r}
date_before_ppm <- as.Date("2013-08-28")
cran_monthly_package_number[
min(
which(
cran_monthly_package_number$date >= date_before_ppm
)
),
]
```
## Acknowledgements
The `scrape_cran()` function is essentially a tidyversification of this [github gist](https://gist.github.com/daroczig/3cf06d6db4be2bbe3368) written by @daroczig.
## Code of Conduct
Please note that this project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.