Skip to content

Instantly share code, notes, and snippets.

@jdblischak
Created July 26, 2019 16:12
Show Gist options
  • Save jdblischak/3873229331397d831a90012f13df46f6 to your computer and use it in GitHub Desktop.
Save jdblischak/3873229331397d831a90012f13df46f6 to your computer and use it in GitHub Desktop.
Do CRAN packages that depend on the stats package use a copyleft license?
#!/usr/bin/env Rscript
# Do CRAN packages that depend on the stats package use a copyleft license?
# https://twitter.com/cimentadaj/status/1154420408508043264
Sys.Date()
## [1] "2019-07-26"
library(stringr)
x <- as.data.frame(available.packages(), stringsAsFactors = FALSE)
x$copyleft <- str_detect(x$License, "GPL") |
str_detect(x$License, "General Public License")
mean(x$copyleft)
## [1] 0.8170245
table(x$copyleft)
##
## FALSE TRUE
## 2659 11873
x$Depends <- ifelse(is.na(x$Depends), "", x$Depends)
x$Imports <- ifelse(is.na(x$Imports), "", x$Imports)
x$Suggests <- ifelse(is.na(x$Suggests), "", x$Suggests)
x$stats <- str_detect(x$Depends, "\\bstats\\b") |
str_detect(x$Imports, "\\bstats\\b") |
str_detect(x$Suggests, "\\bstats\\b")
mean(x$stats, na.rm = TRUE)
## [1] 0.2580512
table(x$stats, useNA = "ifany")
##
## FALSE TRUE
## 10782 3750
table(x$copyleft, x$stats, dnn = c("copyleft", "stats"))
## stats
## copyleft FALSE TRUE
## FALSE 2160 499
## TRUE 8622 3251
sum(!x$copyleft & x$stats) / sum(x$stats)
## [1] 0.1330667
x[!x$copyleft & x$stats, c("Package", "License")][1:5, ]
## Package License
## ABCoptim ABCoptim MIT + file LICENSE
## acmeR acmeR MIT + file LICENSE
## AGread AGread MIT + file LICENSE
## ahpsurvey ahpsurvey MIT + file LICENSE
## airr airr CC BY 4.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment