Closed ThomasKraft closed 2 years ago
Hi Thomas
I should add this to the documentation, i don't think it's there.
You actually don't have a problem with what you want to do. Install the package you want to use from GitHub. This won't load anything, it will just save files to the hard drive, nothing is on your R environment.
Then, when using that package, you can first run groundhog.library()
to load all packages you want with version control, and load the GitHub downloaded package last, any dependencies it has, will be based off those you already loaded.
Now, the GitHub package will load also dependencies you have not loaded that it needs, to ensure all those dependencies are version controlled, you can do this (example with pkg papaja)
library('groundhog')
groundhog.day = '2021-09-01'
pkgs1 <- c('gtools','devtools')
groundhog.library(pkgs1, groundhog.day)
#install papaja (if neede)
#without the dependencies, though nothing bad happens if you do install them, you just won't load them)
install_github("crsh/papaja",dependencies = FALSE)
#Figure out which packages papaja depends on
pkgs_for_papaja <- gtools::getDependencies('papaja')
#Groundhog load those dependencies
groundhog.library(pkgs_for_papaja , groundhog.day)
#Load papaja from non-groundhog library
library(papaja)
#Load packages you want to use
groundhog.library('dplyr',groundhog.day)
Thanks @urisohn, this works brilliantly! Would be great to add this to the documentation, and the example makes it very easy to follow.
My apologies if I have missed this in the package documentation, but I am wondering if there are any solutions to using
groundhog.library
alongside a package which can only only be installed viadevtools::install_github()
. The issue I am experiencing is that the package installed viainstall_github
has it's own dependencies, which overlap with packages that I would like to load usinggroundhog.library
. The problem of course is that I'm either asking R to essentially load 2 versions of the same package, or I lose version control on all of my dependencies.Are there any suggestions from experience on how to handle this?