pkginfo: Tools for Retrieving R Package Information

packages
An experimental R package for retrieving R package information.
Author

Aravind Hebbali

Published

July 5, 2019

pkginfo

Motivation

There are several wonderful tools for retrieving information about R packages, some of which are listed below:

We have used some or all of these to track/monitor our own R packages available on CRAN. Over time, we wanted to have a single interface which would retrieve information from different places including:

And below is a demo of what we came up with…

The above shiny app can be launched with:

pkginfo::pkginfo_dashboard()

Introduction

pkginfo will allow you to retrieve information from multiple places. The shiny app is especially useful if you are looking for information about multiple R packages. pkginfo provides two APIs, one is object oriented, the other one is procedural, and in this post, we will show you how to use them.

Installation

You can install the development version from GitHub with:

devtools::install_github("rsquaredacademy/pkginfo")

course ad


Object Oriented API

The object oriented API uses R6 classes.

library(pkginfo)

GitHub

Creating a new GitHubRepo object

myRepo <- GitHubRepo$new("olsrr", "rsquaredacademy")

Stars, Forks & Issues

get_stats() will report the number of stars, forks and open issues.

myRepo$get_stats()
# A tibble: 1 × 3
  stars issues forks
  <int>  <int> <int>
1   102     20    24

Issues

get_issues() will report the date, number, author and title of all the open issues.

myRepo$get_issues()
# A tibble: 20 × 4
   date       number author         title                                       
   <date>      <int> <chr>          <chr>                                       
 1 2026-10-04    226 aravindhebbali "docs: cross-link Data Visualization with R…
 2 2026-09-15    225 aravindhebbali "[Sprint 0.1] Golden textbook test suite, s…
 3 2026-09-15    224 aravindhebbali "[P0-2] Information Criteria Mathematical R…
 4 2026-04-15    222 aravindhebbali "Release olsrr 0.7.0"                       
 5 2025-03-04    221 viqule11       "ols_regress() Outputting Incorrect MSE/RMS…
 6 2024-10-29    215 LSantanaZA     "olsrr 0.60 - olsrr::ols_step_all_possible …
 7 2023-06-24    206 kaygmz         "error while using olsrr function: "        
 8 2022-07-27    199 hirscht        "ols_step_forward_p(...) problem using many…
 9 2021-08-13    186 aravindhebbali "Error in stepwise backward selection "     
10 2020-12-14    172 yayyb          "Unable to output the result using function…
11 2020-12-05    170 comatrion      "AICc metric"                               
12 2020-06-06    163 AminHP         "Stepwise selection based on Adjusted R-Squ…
13 2020-05-05    162 linusjf        "User must be able to specify different bes…
14 2020-05-04    161 linusjf        "ggplot (or grob) object must be printed wh…
15 2020-05-04    160 linusjf        "Methods returning data.frame of decision c…
16 2020-04-28    158 linusjf        "Cannot coerce class ‘\"function\"’ to a da…
17 2019-12-10    146 sblanco74      "Hi @aravindhebbali"                        
18 2019-11-18    138 vasili111      "Linear mixed model support?"               
19 2019-10-04    137 aravindhebbali "Automated report"                          
20 2018-09-21     92 cccfran        "categorical variable"                      

Branches

get_branches() will report the name of the branches.

myRepo$get_branches()
# A tibble: 3 × 1
  branches          
  <chr>             
1 develop           
2 docs/link-viz-base
3 master            

Build Status & Code Coverage

The build status is reported from Travis CI and Appveyor while code coverage is reported from Codecov

Note

Travis CI was shut down for open source projects in 2021 and Codecov no longer serves the endpoint this method expects, so the next two calls cannot be re-executed. The code is kept for reference; the outputs have been omitted rather than regenerated.

Travis CI
myRepo$get_travis_status()
Codecov
myRepo$get_coverage()

youtube ad


Procedural API

GitHub

To use the procedural API for retrieving GitHub information, you need to provide the following inputs:

  • package/repo name
  • GitHUb user/organization name (optional)

If you do not know the GitHub user/org name, leave it empty. pkginfo will look for the user/org name in the URLS available on the CRAN page of the package.

Stars, Forks & Issues

get_gh_stats("olsrr", "rsquaredacademy")
# A tibble: 1 × 3
  stars issues forks
  <int>  <int> <int>
1   102     20    24

Issues

get_gh_issues("olsrr", "rsquaredacademy")
# A tibble: 20 × 4
   date       number author         title                                       
   <date>      <int> <chr>          <chr>                                       
 1 2026-10-04    226 aravindhebbali "docs: cross-link Data Visualization with R…
 2 2026-09-15    225 aravindhebbali "[Sprint 0.1] Golden textbook test suite, s…
 3 2026-09-15    224 aravindhebbali "[P0-2] Information Criteria Mathematical R…
 4 2026-04-15    222 aravindhebbali "Release olsrr 0.7.0"                       
 5 2025-03-04    221 viqule11       "ols_regress() Outputting Incorrect MSE/RMS…
 6 2024-10-29    215 LSantanaZA     "olsrr 0.60 - olsrr::ols_step_all_possible …
 7 2023-06-24    206 kaygmz         "error while using olsrr function: "        
 8 2022-07-27    199 hirscht        "ols_step_forward_p(...) problem using many…
 9 2021-08-13    186 aravindhebbali "Error in stepwise backward selection "     
10 2020-12-14    172 yayyb          "Unable to output the result using function…
11 2020-12-05    170 comatrion      "AICc metric"                               
12 2020-06-06    163 AminHP         "Stepwise selection based on Adjusted R-Squ…
13 2020-05-05    162 linusjf        "User must be able to specify different bes…
14 2020-05-04    161 linusjf        "ggplot (or grob) object must be printed wh…
15 2020-05-04    160 linusjf        "Methods returning data.frame of decision c…
16 2020-04-28    158 linusjf        "Cannot coerce class ‘\"function\"’ to a da…
17 2019-12-10    146 sblanco74      "Hi @aravindhebbali"                        
18 2019-11-18    138 vasili111      "Linear mixed model support?"               
19 2019-10-04    137 aravindhebbali "Automated report"                          
20 2018-09-21     92 cccfran        "categorical variable"                      

packages ad


CRAN Check Results

The CRAN check results is reported using the cchecksapi API.

get_pkg_cran_check_results("olsrr")
# A tibble: 13 × 3
   os                        r       status
   <chr>                     <chr>   <chr> 
 1 linux-x86_64              patched OK    
 2 linux-x86_64              release OK    
 3 linux-x86_64-debian-clang devel   OK    
 4 linux-x86_64-debian-gcc   devel   OK    
 5 linux-x86_64-fedora-clang devel   OK    
 6 linux-x86_64-fedora-gcc   devel   OK    
 7 macos-arm64               release OK    
 8 macos-arm64               oldrel  OK    
 9 macos-x86_64              release OK    
10 macos-x86_64              oldrel  OK    
11 windows-x86_64            devel   OK    
12 windows-x86_64            release OK    
13 windows-x86_64            oldrel  OK    

Build Status

You can check the build status of a package from both Travis CI and Appveyor.

Note

The Travis CI helper below refers to a service that no longer exists, so it is shown but not executed.

Travis CI

get_status_travis("olsrr", "rsquaredacademy")

Appveyor

get_status_appveyor("olsrr", "rsquaredacademy")
[1] "failed"

Code Coverage

Report code coverage for the package from the coverage service Codecov. We hope to add coverage from Coveralls in the near future.

Note

The Codecov endpoint used by this helper no longer returns the JSON the package expects, so the call is shown but not executed.

get_code_coverage("olsrr", "rsquaredacademy")

Stack Overflow

Questions tagged with the package name will be displayed from Stack Overflow.

get_so_questions("dplyr")
# A tibble: 30 × 6
   date       title                                   owner answered views link 
   <date>     <chr>                                   <chr> <lgl>    <int> <chr>
 1 2021-08-04 How to copy multiple data frames to a … mr_p… TRUE       424 http…
 2 2022-10-28 Understanding `purrr::pmap` with a dat… Juli… TRUE       295 http…
 3 2026-10-04 Avoid `zoo:na.fill(x, &quot;extend&quo… rtur… TRUE       128 http…
 4 2026-10-01 Changing the class of a column using d… drma… TRUE       150 http…
 5 2022-11-24 Replacing values by cell index across … Seym… FALSE      153 http…
 6 2019-09-05 R: Calculate percentage of activities … HCAI  TRUE        70 http…
 7 2026-09-23 Creating a function to find two values… Sabr… TRUE       290 http…
 8 2026-09-18 st_sample() applied to sf lines not pl… Kail… TRUE       175 http…
 9 2016-10-22 no applicable method for &#39;group_by… Neil  FALSE    11214 http…
10 2026-09-01 dplyr::pick behaving differently than … Janu… TRUE       224 http…
# ℹ 20 more rows

To Do..

In the near future, pkginfo will retrieve information:

  • about packages that are available on GitHub/GitLab but not on CRAN
  • packages that are available on GitLab
  • about code coverage from Coveralls
  • about Twitter mentions

We did not have any specific end user in mind while developing but believe it will be more useful to package developers/maintainers. Suggestions/feedbacks and pull requests are always welcome.

If you see mistakes or want to suggest changes, please create an issue on the source repository or reach out to us at feedback@rsquaredacademy.com.