Skip to contents

The cards show a few numbers and charts out of the statistics that collect_stats() collects, and the statistics hold much more: the page views of each repository on each day, the sites that sent the visitors, each star with its time, each GitHub Actions run, and your contributions on each day since you joined GitHub. This article looks into them with base R. It uses the statistics of the made-up user of get_example_stats(); yours come from collect_stats(), or from read_stats() once collected, as Plot the cards in R shows.

library(rghcard)
stats <- get_example_stats()
stats
#> GitHub statistics of example-user, collected until 2026-12-03
#> 8 repositories, 101 stars, traffic from 2026-11-03 to 2026-12-02, 4,132 contributions since 2019-03-14
#> Tables: repos (8 rows), views (240 rows), clones (240 rows), traffic (8 rows), referrers (12 rows), pages (9 rows), releases (4 rows), actions (87 rows), languages (15 rows), stars (100 rows), profile (1 row), contributions (2822 rows), commits (69 rows), contribution_types (8 rows) 
#> Each table is a data frame, such as stats$views: ?rghcard_stats describes their columns.

A list of 14 tables

The statistics are a list of data frames, one for each table of the history, and $ gets one, such as stats$repos. In RStudio or Positron, View(stats$repos) shows a table whole.

names(stats)
#>  [1] "repos"              "views"              "clones"             "traffic"            "referrers"          "pages"              "releases"           "actions"            "languages"         
#> [10] "stars"              "profile"            "contributions"      "commits"            "contribution_types"
Table One row is
repos a repository, on a day of collection
views the page views of a repository on a day
clones the clones of a repository on a day
traffic GitHub’s totals of a repository for the 14 days it keeps, on a day of collection
referrers a site that sent visitors to a repository in those 14 days
pages one of the most viewed pages of a repository in those 14 days
releases a file of a release, with its downloads
actions a GitHub Actions run
languages the code of a repository in a language
stars the stars of a repository on a day
profile the followers of the user, on a day of collection
contributions the contributions of the user on a day
commits the commits of the user in a repository in a year
contribution_types the contributions of the user in a year, by type

?rghcard_stats describes every column of every table. Days and times are text, such as "2026-12-03", in UTC, and as.Date() turns them into dates. Three attributes say whose the statistics are and when they were collected:

attr(stats, "user")
#> [1] "example-user"
attr(stats, "updated")
#> [1] "2026-12-03"
attr(stats, "joined")
#> [1] "2019-03-14"

Your repositories

repos has a row for each repository on each day of collection, so the repositories as they are now are the rows of the last day:

repos <- stats$repos[stats$repos$date == max(stats$repos$date), ]
repos <- repos[order(repos$stars, decreasing = TRUE), ]
repos[, c("repo", "stars", "forks", "watchers", "open_issues", "language")]
#>            repo stars forks watchers open_issues language
#> 1    tidysurvey    48     9        6           5        R
#> 2       plotkit    23     4        4           2        R
#> 3 shiny-weather    12     2        2           1        R
#> 5 workshop-2026     7     3        2           0        R
#> 8     pyscripts     5     1        1           1   Python
#> 4        thesis     3     0        1           0      TeX
#> 6       website     2     0        1           0     HTML
#> 7      dotfiles     1     0        1           0    Shell

The ten with the most stars, as bars. The first par() sets quieter axes, gray and without a box, which stay for the other charts of this article, and the second leaves room on the left for the longest name:

top <- head(repos, 10)
par(las = 1, bty = "n", fg = "#c2c2c2", col.axis = "#666666")
par(mar = c(2.5, max(nchar(top$repo)) / 2 + 1, 2, 1))
barplot(rev(top$stars), names.arg = rev(top$repo), horiz = TRUE, space = 0.5,
        col = "#257de0", border = NA, main = "Stars per repository")

Bars of the stars of each repository of example-user: tidysurvey 48, plotkit 23, shiny-weather 12, workshop-2026 7, pyscripts 5, thesis 3, website 2 and dotfiles 1.

Page views and clones

views and clones have a row for each repository and day. Their sum per day, without the day of the collection, which GitHub was still counting and would look like a drop:

views <- aggregate(count ~ date, data = stats$views, FUN = sum)
views <- views[as.Date(views$date) < attr(stats, "updated"), ]
head(views)
#>         date count
#> 1 2026-11-03    47
#> 2 2026-11-04    30
#> 3 2026-11-05    26
#> 4 2026-11-06    53
#> 5 2026-11-07    22
#> 6 2026-11-08     9
par(mar = c(2.5, 3, 2, 1))
barplot(views$count, names.arg = format(as.Date(views$date), "%d %b"),
        col = "#257de0", border = NA, main = "Page views per day")

Columns of the page views of example-user per day, from 3 November to 2 December 2026: between 9 and 82 a day, half of the days between 24 and 43, and the most on 20 November.

Their sum per repository:

per_repo <- aggregate(cbind(count, uniques) ~ repo, data = stats$views, FUN = sum)
per_repo[order(per_repo$count, decreasing = TRUE), ]
#>            repo count uniques
#> 6    tidysurvey   434     239
#> 2       plotkit   202      99
#> 4 shiny-weather   143      70
#> 7       website   114      65
#> 8 workshop-2026    88      49
#> 3     pyscripts    52      31
#> 5        thesis    34      21
#> 1      dotfiles     5       4

uniques counts someone who visits on three days three times, once a day. traffic has GitHub’s own totals for the 14 days it keeps, in which they count once: visitors and cloners.

stats$traffic[, c("repo", "views", "visitors", "clones", "cloners")]
#>            repo views visitors clones cloners
#> 1    tidysurvey   238       79    272      77
#> 2       plotkit    89       27    105      33
#> 3 shiny-weather    72       20    103      28
#> 4        thesis    24        8     11       5
#> 5 workshop-2026    37       12     27       8
#> 6       website    61       20     93      29
#> 7      dotfiles     3        1      9       4
#> 8     pyscripts    30        9     14       6

Where the visitors come from

referrers has the ten sites that sent the most visitors to each repository in the 14 days that GitHub keeps, on each day of collection. The sites of the last collection, summed over the repositories, and the ten that sent the most as bars:

latest <- stats$referrers[stats$referrers$fetched == max(stats$referrers$fetched), ]
sites <- aggregate(count ~ referrer, data = latest, FUN = sum)
sites <- sites[order(sites$count, decreasing = TRUE), ]
sites
#>                      referrer count
#> 5                  google.com   103
#> 4                  github.com    67
#> 2 example-user.r-universe.dev    22
#> 6           stackoverflow.com     9
#> 3               fosstodon.org     6
#> 1              duckduckgo.com     5
top <- head(sites, 10)
par(mar = c(2.5, max(nchar(top$referrer)) / 2 + 1, 2, 1))
barplot(rev(top$count), names.arg = rev(top$referrer), horiz = TRUE, space = 0.5,
        col = "#257de0", border = NA, main = "Page views per referring site")

Bars of the page views that each site sent in the last 14 days: google.com 103, github.com 67, example-user.r-universe.dev 22, stackoverflow.com 9, fosstodon.org 6 and duckduckgo.com 5.

pages has the most viewed pages of each repository in the same way:

pages <- stats$pages[stats$pages$fetched == max(stats$pages$fetched), ]
pages[order(pages$count, decreasing = TRUE), c("title", "count", "uniques")]
#>                                 title count uniques
#> 1    GitHub · example-user/tidysurvey    98      40
#> 5       GitHub · example-user/plotkit    52      21
#> 7 GitHub · example-user/shiny-weather    33      15
#> 2    Issues · example-user/tidysurvey    24       8
#> 8       GitHub · example-user/website    18       8
#> 9 GitHub · example-user/workshop-2026    16       9
#> 3 README.md · example-user/tidysurvey    15       9
#> 4  Releases · example-user/tidysurvey    12       7
#> 6            R · example-user/plotkit     9       4

Contributions

contributions has a row for each day since the user joined GitHub. Their sum per year, of which the first and the last are not whole years:

contributions <- stats$contributions
per_year <- tapply(contributions$count, substr(contributions$date, 1, 4), sum)
per_year
#> 2019 2020 2021 2022 2023 2024 2025 2026 
#>   33  105  214  420  477  685 1028 1170
par(mar = c(2.5, 3.5, 2, 1))
barplot(per_year, space = 1, col = "#257de0", border = NA, main = "Contributions per year")

Columns of the contributions of example-user per year, rising from 33 in 2019 to 105 in 2020, 214 in 2021, 420 in 2022, 477 in 2023, 685 in 2024, 1,028 in 2025 and 1,170 in 2026.

Per day of the week, from 1 for Monday to 7 for Sunday, which format() gives in any language:

weekday <- as.integer(format(as.Date(contributions$date), "%u"))
per_weekday <- tapply(contributions$count, weekday, sum)
names(per_weekday) <- c("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
per_weekday
#> Mon Tue Wed Thu Fri Sat Sun 
#> 713 658 710 695 728 309 319
barplot(per_weekday, space = 1, col = "#257de0", border = NA,
        main = "Contributions per day of the week")

Columns of the contributions of example-user per day of the week since 2019: 658 to 728 on each weekday, and 309 on Saturdays and 319 on Sundays.

contribution_types splits each year by type. private counts the contributions to private repositories, which GitHub gives as bare numbers:

stats$contribution_types
#>   year commits issues pull_requests reviews repositories private
#> 1 2019      20      5             2       0            3       3
#> 2 2020      63     13            12      14            2       1
#> 3 2021     128     24            35      15            2      10
#> 4 2022     252     46            66      33            1      22
#> 5 2023     286     61            71      38            2      19
#> 6 2024     411     72           110      64            1      27
#> 7 2025     617    121           176      81            2      31
#> 8 2026     702    132           182     111            1      42

Code and commits

languages has the bytes of code of each repository in each language, as the language bar of a repository counts them. Their sum per language, in kilobytes, and the ten largest as bars:

code <- aggregate(bytes ~ language, data = stats$languages, FUN = sum)
code$kilobytes <- round(code$bytes / 1000)
code <- code[order(code$bytes, decreasing = TRUE), ]
code
#>      language  bytes kilobytes
#> 6           R 748368       748
#> 9         TeX 243980       244
#> 3        HTML  61210        61
#> 5      Python  42167        42
#> 1         C++  38212        38
#> 4  JavaScript  17557        18
#> 8       Shell   9120         9
#> 7        SCSS   8344         8
#> 2         CSS   4120         4
#> 10 Vim Script   3080         3
top <- head(code, 10)
par(mar = c(2.5, max(nchar(top$language)) / 2 + 1, 2, 1))
barplot(rev(top$kilobytes), names.arg = rev(top$language), horiz = TRUE, space = 0.5,
        col = "#257de0", border = NA, main = "Code per language, in kilobytes")

Bars of the code of example-user per language, in kilobytes: R 748, TeX 244, HTML 61, Python 42, C++ 38, JavaScript 18, Shell 9, SCSS 8, CSS 4 and Vim Script 3.

commits has the commits of the user in each repository each year, in repositories of anyone: owner says whose. Their sum per repository:

commits <- aggregate(commits ~ owner + repo, data = stats$commits, FUN = sum)
commits[order(commits$commits, decreasing = TRUE), ]
#>          owner          repo commits
#> 7 example-user    tidysurvey     783
#> 3 example-user       plotkit     455
#> 5 example-user shiny-weather     270
#> 4 example-user     pyscripts     267
#> 8 example-user       website     205
#> 9 example-user workshop-2026     166
#> 6 example-user        thesis     155
#> 2 rstats-group       ggextra     107
#> 1 example-user      dotfiles      71

Stars over time

stars has the stars of each repository on each day it got any, since the repository was created, so they can be counted up to any day. Their number over time, of all the repositories together:

per_day <- aggregate(count ~ date, data = stats$stars, FUN = sum)
par(mar = c(2.5, 3.5, 2, 1))
plot(as.Date(per_day$date), cumsum(per_day$count), type = "s", lwd = 2, col = "#257de0",
     xlab = "", ylab = "", main = "Stars over time")

A line of the number of stars of example-user over time, from the first star in September 2020 to 38 at the end of 2024, 66 at the end of 2025 and 101 at the end of November 2026.

GitHub Actions runs

actions has a row for each run, with how it ended and its times. The runs of each workflow, by how they ended:

runs <- stats$actions
table(runs$workflow, runs$conclusion)
#>                             
#>                              failure success
#>   Deploy app                       2       5
#>   pages build and deployment       1      18
#>   R-CMD-check                      6      55

The minutes that a run of each workflow takes, from its start to its end, as a median:

utc <- function(x) as.POSIXct(x, tz = "UTC", format = "%Y-%m-%dT%H:%M:%SZ")
runs$minutes <- as.numeric(difftime(utc(runs$finished), utc(runs$started), units = "mins"))
aggregate(minutes ~ workflow, data = runs, FUN = median)
#>                     workflow  minutes
#> 1                 Deploy app 3.433333
#> 2 pages build and deployment 1.033333
#> 3                R-CMD-check 9.066667

Releases and followers

releases has the downloads of each file of each release, since it was published:

releases <- stats$releases[stats$releases$fetched == max(stats$releases$fetched), ]
releases[, c("repo", "release", "file", "downloads")]
#>            repo release                    file downloads
#> 1    tidysurvey  v1.2.0 tidysurvey_1.2.0.tar.gz       312
#> 2    tidysurvey  v1.1.0 tidysurvey_1.1.0.tar.gz       188
#> 3       plotkit  v0.3.0    plotkit_0.3.0.tar.gz        85
#> 4 shiny-weather  v1.0.0       shiny-weather.zip        14

profile has the followers of the user on each day of collection, so with weekly collections it shows how they grow:

stats$profile
#>         date followers following
#> 1 2026-12-03        87        41

Keep what you find

The tables are already CSV files, in the folder of the history. A table of your own saves as one too, for a spreadsheet:

write.csv(sites, "referrers.csv", row.names = FALSE)

ggplot2, or any other package of charts, draws the tables as well as base R does.