Elegant way to check for missing packages and install them?
Asked 07 September, 2021
Viewed 2.6K times
  • 64
Votes

I seem to be sharing a lot of code with coauthors these days. Many of them are novice/intermediate R users and don't realize that they have to install packages they don't already have.

Is there an elegant way to call installed.packages(), compare that to the ones I am loading and install if missing?

29 Answer