Here are some tips on updating R for Windows.
When you install a new version of R, it is installed in a new directory. This can be a problem because you would need to install all of the packages again.
Seeing the Packages You Have Installed and Manually Installing Them
You installed a new version of R, but it does not have many of the packages you had installed in your previous version of R. In fact, you are having trouble remembering the names of the packages you installed. This strategy helps you identify packages that have been installed in your old version of R so you can then reinstall the into your new version of R.
1. Identify the packages you installed in your old version of R
You can see the list of all of the packages you have installed like this. Note this includes the standard packages that come with R as well as ones you installed.
If you want to just see the first four columns, you can type this
If you want to see just column 1 and 4 (the package name and it’s priority) then you can type this. Packages that have priority of NA are more likely to be ones that you installed.
2. Install packages into your new version of R.
You can install packages into your new version of R by choosing, from the pulldown menu, Packages and then Install Packages from CRAN. You can then look for the package name that you want to install. You can use Ctrl-Click (pressing the control key and left click) to select more than one package at a time for installation.
Seeing where your packages are installed and copying them all at once
You installed a new version of R, but it does not have many of the packages you had installed in your previous version of R. In fact, you just want to copy the library directory that you used from your old copy of R to your new copy of R. Here is how you can do that.
1. Identify the library directory for your old and new version of R.
You can use the .Library command to see where your libraries (packages) are stored. If you install a new version of R, you could execute the .Library command for your old version of R, and your new version of R.
2. Copy the contents of the library directory from the old version of R to the new version of R
You can then use windows explorer to copy the library directory from your old version of R to your new version R.
3. Update the packages
It is possible that your old version of R might have had some packages that were out of date, and that you clobbered the newer version. That is OK because you can use the update.packages() function to bring your packages up to date, like this.
If you do not want to be asked about updating each package, you can use the ask=F option, as shown below.