Best practices for using RStudio Addins with Packrat

I'm using packrat for the first time in R, what's the best way to install Rstudio addins?

To use the styler package for example, I can run install.packages("styler") and make sure it is not added to the snapshot. Is this the recommended solution, or is there a way to install a package globally so that all projects can use it - similar to the global flag when using npm install?

2 Likes

This is a great question, and an interesting use case - thanks! So part of packrat's functionality is that it specifically isolates you from the "global" environment, lest you pick up a package that you are not intending and get unexpected behavior / unreproducible results.

However, what you can specify is an "external package." This is explained towards the end of this page: Packrat: Reproducible package management for R

An "external package" is one that will be loaded from your user environment, but not acknowledged / recorded in the packrat.lock file.

Note that a "newer" version of packrat has been created, in case it interests you. It is called renv and it has similar functionality, along with some noteworthy improvements. Let us know if you have any more questions or any issues with this approach!

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.