Created
August 14, 2023 12:57
-
-
Save arthurgailes/1a593442f49a21ba969c8dce79a3dd47 to your computer and use it in GitHub Desktop.
Quickly show time series for R package downloads
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
# quick R script for seeing the trends in downloads for a package | |
library(cranlogs) | |
library(ggplot2) | |
library(collapse) | |
library(lubridate) | |
package <- "shiny" | |
# get downloads for a specific date | |
x <- cran_downloads(packages=shiny, from="2015-06-01", to="2023-08-14") | |
head(x) | |
x |> | |
qTBL() |> | |
fmutate(date = floor_date(date, "month")) |> | |
fsubset(date != max(date)) |> | |
fgroup_by(date) |> | |
fsummarize(count = fsum(count)) |> | |
ggplot() + | |
geom_line(aes(date, count)) + | |
scale_y_continuous(labels = scales::label_comma()) + | |
theme_minimal() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment