Skip to contents

What collect_stats(), read_stats() and get_example_stats() return: an rghcard_stats object, a list of 14 data frames, one for each table of the history, which the cards draw. Each table is also a CSV file in the folder of the history, such as views.csv. Printing the statistics shows a summary; $ gets a table, such as stats$views, and View(stats$views) shows it whole in RStudio or Positron.

Reading the tables

  • Types. Each column holds text, numbers, or TRUE and FALSE. Days are text such as "2026-12-04", and times text such as "2026-12-04T05:17:03Z", both in UTC, as GitHub gives them; as.Date() turns either into a date. Years and the ids of runs are text too.

  • Tables that grow, and tables replaced. Each collection adds its rows to most tables, and a row with the same identifying columns as an older one replaces it: the traffic of the day of a collection is still being counted, and the next collection brings the whole day. The tables languages, stars, contributions, commits and contribution_types are read whole, and replaced, at each collection.

  • Unique visitors and cloners. uniques in views, referrers and pages is the unique visitors, and in clones the unique cloners; the totals of traffic call them visitors and cloners.

  • Empty tables and missing values. A table that a collection could not fill, such as views without a token of the user, has no rows but keeps its columns. NA marks a value that GitHub did not give, such as the main language of a repository without code.

The statistics also have three attributes, which attr() reads, such as attr(stats, "updated"): user, the GitHub user name; updated, the day of the last collection; and joined, the day the user joined GitHub, NA when unknown.

The tables

repos

The repositories of the user, one row for each repository on each day of collection, identified by date and repo.

ColumnTypeWhat it holds
datetextThe day of the collection.
repotextThe name of the repository.
privatelogicalWhether the repository is private.
forklogicalWhether it is a fork.
archivedlogicalWhether it is archived.
starsnumberIts stars on that day.
forksnumberIts forks.
watchersnumberThe users who watch it; NA in rows collected before rghcard 0.4.0.
open_issuesnumberIts open issues and pull requests, which GitHub counts together.
size_mbnumberIts size in megabytes, as GitHub counts it.
languagetextIts main language, the one GitHub detects for most of its code.
last_pushtextThe day of the last push to it.

views

The page views of each repository per day, identified by repo and date. GitHub keeps 14 days; the history keeps every day collected.

ColumnTypeWhat it holds
repotextThe repository.
datetextThe day.
countnumberThe page views of the day.
uniquesnumberThe unique visitors of the day.

clones

The clones of each repository per day, identified by repo and date, kept as the page views are.

ColumnTypeWhat it holds
repotextThe repository.
datetextThe day.
countnumberThe clones of the day.
uniquesnumberThe unique cloners of the day.

traffic

GitHub's totals of the 14 days it keeps, for each repository on each day of collection, identified by fetched and repo. Someone who visits on several days counts once in them.

ColumnTypeWhat it holds
fetchedtextThe day of the collection.
repotextThe repository.
viewsnumberThe page views of the 14 days.
visitorsnumberTheir unique visitors.
clonesnumberThe clones of the 14 days.
clonersnumberTheir unique cloners.

referrers

The ten sites that sent the most visitors to each repository in GitHub's 14 days, on each day of collection, identified by fetched, repo and referrer.

ColumnTypeWhat it holds
fetchedtextThe day of the collection.
repotextThe repository.
referrertextThe site, such as google.com or github.com.
countnumberThe page views that it sent in the 14 days.
uniquesnumberThe unique visitors that it sent.

pages

The ten most viewed pages of each repository in GitHub's 14 days, on each day of collection, identified by fetched, repo and path.

ColumnTypeWhat it holds
fetchedtextThe day of the collection.
repotextThe repository.
pathtextThe path of the page on GitHub, such as /example-user/tidysurvey/issues.
titletextThe title of the page.
countnumberIts page views in the 14 days.
uniquesnumberIts unique visitors.

releases

The downloads of each file of each release, on each day of collection, identified by fetched, repo, release and file. Releases without files are left out.

ColumnTypeWhat it holds
fetchedtextThe day of the collection.
repotextThe repository.
releasetextThe tag of the release, such as v1.2.0.
filetextThe name of the file.
downloadsnumberIts downloads since the release was published.

actions

The GitHub Actions runs of the repositories, one row per run, identified by id. Each collection reads the runs of the last actions_days days of collect_stats(), and updates the rows of the runs it had.

ColumnTypeWhat it holds
idtextGitHub's number of the run.
repotextThe repository.
workflowtextThe name of the workflow, such as R-CMD-check.
eventtextWhat started the run, such as push, pull_request or schedule.
conclusiontextHow the run ended, such as success, failure or cancelled; NA while it runs.
createdtextThe time the run was created.
startedtextThe time it started; NA in rows collected before rghcard 0.4.0.
finishedtextThe time it ended; NA while it runs, and in rows collected before rghcard 0.4.0.

languages

The code of each repository in each language, as the language bar of a repository counts it, identified by repo and language. Replaced at each collection.

ColumnTypeWhat it holds
repotextThe repository.
languagetextThe language.
bytesnumberThe bytes of code in that language.

stars

The stars of each repository per day, from GitHub's weekly history of them, which goes back to the day the repository was created: a row for each day with stars, identified by repo and date. Replaced at each collection. GitHub keeps only the stars still given, and counts these days a few hours behind UTC, so a star given early in a day in UTC can be on the day before.

ColumnTypeWhat it holds
repotextThe repository.
datetextThe day.
countnumberThe stars given that day.

profile

The followers of the user, one row for each day of collection, identified by date.

ColumnTypeWhat it holds
datetextThe day of the collection.
followersnumberThe users who follow the user.
followingnumberThe users they follow.

contributions

The contributions of the user on each day since they joined GitHub, as the contribution graph of their profile counts them, identified by date. Replaced at each collection.

ColumnTypeWhat it holds
datetextThe day.
countnumberThe contributions of the day.

commits

The commits of the user in each repository each year, in repositories of anyone, identified by year, owner and repo. Replaced at each collection. Private repositories and forks are left out unless collect_stats() was asked for them, and GitHub gives 100 repositories a year at most.

ColumnTypeWhat it holds
yeartextThe year, such as "2026".
ownertextThe owner of the repository: the user, or someone else.
repotextThe repository.
privatelogicalWhether it is private.
languagetextIts main language.
commitsnumberThe commits of the user in it that year.

contribution_types

The contributions of the user each year by type, identified by year. Replaced at each collection.

ColumnTypeWhat it holds
yeartextThe year.
commitsnumberThe commits.
issuesnumberThe issues opened.
pull_requestsnumberThe pull requests opened.
reviewsnumberThe reviews of pull requests.
repositoriesnumberThe repositories created.
privatenumberThe contributions to private repositories, which GitHub gives as bare numbers.

See also

collect_stats() collects the statistics, read_stats() reads them again, and plot_stats_card() and the other card functions draw them.

Examples

stats <- get_example_stats()
stats                     # a summary
#> 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.
names(stats)              # the 14 tables
#>  [1] "repos"              "views"              "clones"             "traffic"            "referrers"          "pages"              "releases"           "actions"            "languages"         
#> [10] "stars"              "profile"            "contributions"      "commits"            "contribution_types"
head(stats$views)         # one of them
#>         repo       date count uniques
#> 1 tidysurvey 2026-11-03    18      10
#> 2 tidysurvey 2026-11-04    11       6
#> 3 tidysurvey 2026-11-05     8       5
#> 4 tidysurvey 2026-11-06    21       9
#> 5 tidysurvey 2026-11-07    10       6
#> 6 tidysurvey 2026-11-08     4       3
attr(stats, "updated")    # the day of the last collection
#> [1] "2026-12-03"

# the page views of all the repositories per day, the days as dates
views <- aggregate(count ~ date, data = stats$views, FUN = sum)
views$date <- as.Date(views$date)
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