How to keep using package after dev removed it from repo

A few days ago one of my packages gave me an error that would require its re-installation, but I then realized that it's no longer available on GitHub. Can't get the master zip anywhere else.

Thankfully I had the package on another machine so could transfer the library. I simply copied it over as I have the same version of R on both computers.

I tried to build a binary package so I could install it on a packrat project but couldn't do it. I got an error 'dll not found' and a warning 'S3 method declared but not found'. So I gave up.

I've then created a project and installed all the dependencies and took a snapshot. I load the package I can't build from the external library with extlib().
Everything works fine at the moment.

A few questions though.
-As long as I have the snapshot and the same R version I should be able to use the package indefinitely right?
-To transfer it to another computer, what do I need to take into consideration? R version? OS architecture?

Any help would be immensily appreciated.


This is a fantastic question! Sorry for the delay in seeing it.

  • When speaking about reproducibility with packrat, you do need the snapshot along with the source for the package. Usually, I take this source for granted because CRAN makes sources available for all versions of a package. However, you run into an interesting case above in GitHub not guaranteeing the source of the package. (One way to ensure this is to fork the repo yourself on GitHub, which gives you a copy of the source).

  • To transfer to another computer, you only need to take into account the fact that the packages will probably need to be rebuilt. You can try to use the same binary (built) packages if you preserved them in your packrat folder, but there are a lot of subtle / weird problems you can run into if anything has changed (i.e. R version, OS, architecture, dependent libraries, etc.).

But basically, if you have the packrat.lock file (from the snapshot) and access to the package sources (on CRAN, GitHub, or otherwise), then packrat::restore() should build the packages for you in your new environment and send you off to the races!

Another way to think about reproducibility (specifically wrt keeping track of package sources) is to maintain your own CRAN-like repository with miniCRAN or RStudio Package Manager. This allows you to keep your own copy of the package sources in a repository that can then be used to install / build the packages on any computer running R.

Hope that helps!