library(tidyverse)
cran <- dlstats::cran_stats(c("ggsignif", "ggupset", "tidygenomics", "mixdir", "einsum")) %>%
as_tibble()
bioc <- dlstats::bioc_stats(c("sparseMatrixStats", "glmGamPoi", "proDA",
"MatrixGenerics", "transformGamPoi")) %>%
as_tibble()
combined <- bind_rows(cran, transmute(bioc, start, end, downloads = Nb_of_downloads, package))
combined %>%
filter(start > lubridate::today() - lubridate::years(3),
end < lubridate::today()) %>%
mutate(package = fct_reorder(package, -downloads)) %>%
ggplot(aes(end, downloads, group=package, color=package)) +
geom_hline(yintercept = 10^seq(2, 5), linewidth = 0.2, color = "lightgrey") +
geom_line() +
geom_point() +
scale_y_log10(labels = scales::label_comma()) +
scale_x_date(labels = scales::label_date_short(), breaks = lubridate::ym("2020-1", "2021-1", "2022-1", "2023-1", "2024-1", "2025-01", "2026-01")) +
labs("Monthly downloads of my R packages", y = "Downloads / month (log-scale)",
x = "", color = "",
title = "Package downloads from CRAN and Bioconductor",
subtitle = paste0("last updated on ", lubridate::today())) +
cowplot::theme_cowplot()