A user suggested that the loop isn’t necessary. Simply do
It used to take me a while to reinstall all the R packages that I use after upgrading to a new version of R. I couldn’t think of another way to do this than to create a list of installed packages by examining the R package directory, and to manually select and install each one of those packages in the new version of R. In order to ensure that my home and office installation of R had the same packages installed, I did something similar.
I recently discovered that there is a much, much easier way to transfer the packages that you have installed to a different installation of R. I found some R code on the web that I adapted to my needs. Here is what you need to do:
1. Run the script “store_packages.R” in your current version of R.
# store_packages.R # # stores a list of…
View original post 167 more words