Skip to content

Instantly share code, notes, and snippets.

@lwaldron
Last active October 3, 2025 14:23
Show Gist options
  • Select an option

  • Save lwaldron/1723abbe1191611f1a3f53edb5d34402 to your computer and use it in GitHub Desktop.

Select an option

Save lwaldron/1723abbe1191611f1a3f53edb5d34402 to your computer and use it in GitHub Desktop.
Get & plot one month of package download stats for every Bioconductor package and write to csv file
bioc_repos <- BiocManager::repositories()[["BioCsoft"]]
pkgs <- rownames(utils::available.packages(repos = bioc_repos))
#pkgs <- head(pkgs, 100) # for testing
stats <- bioC.logs::bioC_downloads(pkgs, from = "08-2025", to = "09-2025")
names(stats) <- pkgs
stats.df <- Reduce(rbind, stats)
rownames(stats.df) <- pkgs
write.csv(stats.df, file = "bioc-pkg-downloads.csv")
stats.df <- read.csv("bioc-pkg-downloads.csv", row.names = 1)
stats.df <- stats.df[order(stats.df[, "Nb_of_distinct_IPs"], decreasing = TRUE), ]
library(ggplot2)
library(scales)
ggplot(stats.df, aes(x = 1:nrow(stats.df), y = cumsum(Nb_of_distinct_IPs))) +
# Made points smaller by setting size = 0.5
geom_point(stat = "identity", size = 0.5) +
# Set a finer y-scale by providing more breaks and comma-formatted labels
scale_y_continuous(
labels = scales::comma, # Use commas (e.g., 1,000,000) for readability
breaks = scales::pretty_breaks(n = 10) # Request ~10 breaks for a finer grid
) +
xlab("# packages") +
ylab("# downloads") +
ggtitle("Cumulative sum of downloads by # packages")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment