Plot package download counts over time by source

Description

Fetches download data from CRAN (via packageRank) and optionally GitHub Releases (via gh), then plots new and cumulative downloads.

Usage

graph_downloads(package, ...)

Arguments

package Character; CRAN package name to graph.
…

Arguments passed on to .get_download_data

github_repo
Character string “owner/name” for a GitHub repository to also include release-asset downloads from, or NULL (default) for CRAN only.
new
Logical; include new (daily) downloads? Defaults to TRUE.
cumulative
Logical; include cumulative downloads? Defaults to TRUE.
start
Start date for the plot (a Date or string coercible to one). Defaults to NULL (all available data).
unit
Character string specifying the time unit to aggregate by. One of “day”, “week”, “month”, “quarter”, or “year”. Defaults to “month”.
title
Character string for the plot title. Defaults to a description including the package name and time unit. Set to NULL to omit.

Details

GitHub release downloads are cumulative counts per release asset from the GitHub API. New GitHub downloads are derived as the contribution of each release. CRAN downloads are fetched via packageRank::cranDownloads().

Requires the packageRank package (and gh if github_repo is set), listed under Suggests.

Value

A ggplot2::ggplot() object with faceted panels.

Examples

Code

Code
graph_downloads("dplyr", github_repo = "tidyverse/dplyr")

Code
graph_downloads("dplyr", unit = "week", start = "2024-01-01")