Created
August 29, 2019 20:30
-
-
Save jimhester/ae703769d8dc1cab774b9131cd178e00 to your computer and use it in GitHub Desktop.
GitHub vs GitLab for most recent 1000 R package releases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Measure usage of GitHub vs GitLab in R packages. This likely undercounts both GitHub and GitLab, | |
# becuase not every package puts a link to the development repository in their URL or BugReports fields. | |
# remotes::install_github("r-hub/crandb") | |
last_1000 <- crandb::events(archivals = FALSE, limit = 1000) | |
has_url <- function(x, url) { | |
any(grepl(url, c(tolower(x$package$URL), tolower(x$package$BugReports)), fixed = TRUE)) | |
} | |
get_pkg_info <- function(x) { | |
list(package = x$package$Package, | |
maintainer = x$package$Maintainer %||% NA_character_, | |
version = x$package$Version, | |
date = x$date | |
) | |
} | |
library(purrr) | |
all_releases <- map_dfr(last_1000, get_pkg_info) | |
length(unique(all_releases$maintainer)) | |
#> [1] 735 | |
is_github <- map_lgl(last_1000, has_url, url = "github") | |
github_releases <- map_dfr(last_1000[is_github], get_pkg_info) | |
sum(is_github) | |
#> [1] 560 | |
length(unique(github_releases$maintainer)) | |
#> [1] 401 | |
is_gitlab <- map_lgl(last_1000, has_url, url = "gitlab") | |
gitlab_releases <- map_dfr(last_1000[is_gitlab], get_pkg_info) | |
sum(is_gitlab) | |
#> [1] 15 | |
length(unique(gitlab_releases$maintainer)) | |
#> [1] 10 | |
# Created on 2019-08-29 by the [reprex package](https://reprex.tidyverse.org) (v0.3.0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment