How To Quickly Install Packages With A New R Installation

Okay, Joel, here it is. I got these instruction off of the Internet but I do not remember who was the original source.

  1. I keep this file in a RStudio project I call installed_packages.
  2. Before I upgrade I run the first two line to update the package_list.
  3. After I upgrade I go back to project, un-comment the install.packages line and run it.
  4. I also have a line in there if you want a csv copy of the installed packages.
#Get currently installed packages

#work
package_df < - as.data.frame(installed.packages())
package_list <- as.character(package_df$Package)
#write.csv(package_df, file = "package_df.csv")
#Re-install Install packages
#install.packages(package_list)