Is it possible to install different package versions within an R personal library for one specific version of R

385 views Asked by At

Is it possible to install different package versions within a R personal library for one specific version of R; and then to be able to load the exact package version withing a script?

I am trying to make sure I have the exact package version binaries for Windows backed up offsite for each project, so that if I need to reproduce in future, I can then paste these back into the personal library folder, under the relevant R version. So potentially, you could have two package versions within the same R version folder under R\win-library. However I notice there is no version number attached to each packages folder, so I'm not sure how R would identify each version.

1

There are 1 answers

6
Dason On

It sounds like you want to spend some time learning about packrat. It allows a user to have a separate library of packages for each project so there aren't any issues with reproducibility later in the future due to a package updating and possibly breaking other code.

Here is a link to some intro documentation: https://rstudio.github.io/packrat/