-
Notifications
You must be signed in to change notification settings - Fork 3
/
submissions_ropensci_cran.Rmd
77 lines (64 loc) · 2.05 KB
/
submissions_ropensci_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
74
75
76
77
---
title: "Submissions to rOpenSci and CRAN"
author: "Maëlle Salmon"
date: "`r Sys.Date()`"
output:
md_document:
variant: markdown_github
toc: true
---
# Find submitted packages
```{r, cache = TRUE, warning = FALSE}
library("gh")
creation <- NULL
repo <- NULL
is_ok <- TRUE
page <- 1
while(is_ok){
issues <- try(gh("/repos/:owner/:repo/issues", owner = "ropensci",
repo = "onboarding", labels = "package",
state = "all",
page = page), silent = TRUE)
is_ok <- is(issues, "list") & issues[[1]] != ""
if(is_ok){
page <- page + 1
creation <- c(creation, vapply(issues, "[[", "", "created_at"))
repo <- c(repo, vapply(issues, "[[", "", "body"))
}
}
repo <- stringr::str_extract(repo, "Package:.*")
repo <- stringr::str_replace(repo, "Package: ", "")
```
```{r, warning = FALSE}
packages <- tibble::tibble(package = repo,
ropensci_submission = lubridate::ymd_hms(creation))
packages <- unique(packages)
packages <- dplyr::filter(packages, !is.na(package))
packages
```
# Find the ones that are on CRAN
```{r}
library("crandb")
get_cran_oldest_date <- function(package){
results <- try(package(package, version = "all"), silent = TRUE)
if(is(results, "try-error")){
date <- "9999-01-01 00 00 00"
}else{
date <- results$versions[[1]]$date
}
return(date)
}
get_cran_oldest_date("ropenaq")
```
```{r}
dates <- purrr::map_chr(packages$package, get_cran_oldest_date)
dates <- lubridate::ymd_hms(dates)
packages$cran_submission <- dates
packages <- dplyr::mutate(packages,
ropensci_submission = lubridate::as_date(ropensci_submission),
cran_submission = lubridate::as_date(cran_submission))
```
```{r}
knitr::kable(packages)
```
We're looking at `r nrow(packages)` packages. For `r sum(packages$cran_submission < packages$ropensci_submission)` there was a CRAN version before the rOpenSci submission. For `r sum(packages$cran_submission > packages$ropensci_submission)` there wasn't a CRAN version before the rOpenSci submission.