This is basically the “isolation” feature of Packrat. Any packages installed from inside a packrat project are only available to that project and the ones installed outside of the project are not avilable to the project. Now, you’re in a Packrat project which has its own private package library. If you already set the working directory to your desired project directory then simple run packrat::init(). Initialize Packratīefore starting to write the codes for your R project, initialize packrat by running packrat::init(".") and enter your project directory path inside the parantheses. See Package Development Prerequisites for the tools needed for your operating system. You’ll also need to make sure your machine is able to build packages from source.
Reproducible: Packrat saves the exact package version your project depends on, so those exact versions are installed always whenever you run the project anywhere.Portable: Easy to transfer your R projects from one machine to another, or even across platforms.So, next time you start an R session in a packrat project directory, R will only look for packages in your private library and all changes to the packages are made in this private package. Isolated: packrat gives each project its own private package library so installing a new or updated package for one project won’t affect other projects you may be working on.It is a dependency management system for R packages which is isolated, portable, and reproducible. Packrat is the solution to such dependency issues. It can be frustrating to guess what R packages are needed to be installed, right? Or, have you ever updated a package to get code in one of your projects to run, only to find that the updated package makes code in another project stop working? Suppose you’re trying to run someone else’s codes and are bombarded with package installation errors.
Want to change something or add new content? Click the Contribute button! Using Packrat to manage your R package library Visit our GitHub or LinkedIn page to join the Tilburg Science Hub community, or check out our contributors' Hall of Fame!