Using groundhog with GitHub Packages

Currently, groundhog only does version control with CRAN packages, but you can use version-controlled packages from GitHub following the steps below. The step-by-step instructions use the package ‘papaja’ as an example.

Step 1. Load ‘devtools’ and ‘jtools’ to install the GitHub package and its dependencies

library('groundhog')
groundhog.day = '2021-09-01'
pkgs <- c('devtools','jtools)

groundhog.library(pkgs, groundhog.day) 
 

Step 2. Visit the URL for the GitHub package you want to install and find the release (i.e. ‘version’)  you want (if you don’t have a preference, use the most recent release, biggest number listed). The URL is simply the GiHub page with /releases at the end. https://github.com/crsh/papaja/releases

As of this writing the most recent release for our example papaja was v0.1.0.9997 so that’s the version we would install

Step 3. Install, without dependencies, that version of the GitHub package

devtools:install_github("https://github.com/crsh/papaja/v0.1.0.9997",dependencies = FALSE)

Step 4.  Use jtools to obtain the list of all dependencies for that GitHub package

pkgs_for_papaja <- gtools::getDependencies('papaja')

Step 5 Install those dependencies with groundhog

groundhog.library(pkgs_for_papaja , groundhog.day) 

Step 6. Load the GitHub package

library('papaja')


Note:
If you are intimately familiar with the package in question, you can specify, instead of the release, the commit # you wish to install.
Modify Step 2 visiting https://github.com/crsh/papaja/commits and choose the commit you want.
Modify Step 3 by specifying that commit into the installation
devtools::install_github("https://github.com/crsh/papaja/@a231c3628ccf24359cc17f11a5bbc743e3fed920",dependencies = FALSE)