Created
October 2, 2022 15:07
-
-
Save jokergoo/2d9c97033cc35379a0ee63f54f3050d5 to your computer and use it in GitHub Desktop.
Number of downloads from CRAN/Bioc/conda
This file contains 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
library(rvest) | |
library(jsonlite) | |
downloads_from_conda = function(pkg) { | |
x = read_html(paste0("https://anaconda.org/search?q=r-", pkg)) | |
tb = html_nodes(x, "table") %>% html_table() | |
if(length(tb) > 0) { | |
tb = tb[[1]] | |
sum(tb[, 2]) | |
} else { | |
0 | |
} | |
} | |
downloads_from_cran = function(pkg) { | |
x = read_json(paste0("https://cranlogs.r-pkg.org/downloads/total/2001-01-01:2114-01-01/", pkg)) | |
x[[1]]$downloads | |
} | |
downloads_from_bioc = function(pkg) { | |
df = read.table(paste0("http://bioconductor.org/packages/stats/bioc/", pkg, "/", pkg, "_stats.tab"), header = TRUE) | |
sum(df[df[, "Month"] != "all", "Nb_of_downloads"]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment