Research and Statistical Support

UIT | ACUS | Help Desk | Training | About Us | Publications | RSS Home

Back to the Do it yourself Introduction to R

Maintaining R is not difficult, it simply requires a few easy steps which will be covered here.

If you have your 'Rprofile.site' file setup to auto-load packages when R is started, then you will need to remove that file from the R directory prior to updating. If you do not, then the packages which you have specified to auto-load will never be updated. This is because R will not update a package if that package is loaded into the workspace. So, if you need to remove the 'Rprofile.site' file, then find the 'etc' folder in your R installation. Two examples of where it might be located are below where x.xx.x refers to the version number of the R installation you have (e.g. R-2.15.0).

C:\R\R-X.XX.X\etc

C:\Program Files\R\R-X.XX.X\etc

Once inside the 'etc' folder, right-click on the 'Rprofile.site' file and select "Cut". Now right-click on your desktop and select "Paste". You do not need to close the 'etc' window/folder.

1.) Start R.

2.) Second, click on "Packages" at the top of the R console and then select "Set CRAN mirror...". Choose the mirror site you wish to use; it is recommended you choose a mirror site closest to your physical location -- this will enable quicker downloading. I generally select USA (TX 1), which is in Dallas, TX. You may also specify a default mirror site in your 'Rprofile.site' file as discussed previously. You can find a list of mirror site locations at CRAN by clicking here

 

3.) Next, click again on "Packages" in the R console and then select "Select repositories...". By default, CRAN and CRAN (extras) are selected; I generally also select R-Forge which contains packages being developed (often very recent updates to existing packages). Then click the OK button.

4.) Next, type the following line in the R console and hit the enter key:

x <- new.packages()

This line tells R you want to search for new packages at the repositories selected above and if any are available, they will be assigned to the object "x". The reason for doing this is so you can then (once it finishes; it can take a few minutes), type "x" and hit the return key to see the names of the new packages; thus allowing you to decide if you want all of them, some of them, or none of them.

5.) Next, install the new packages by simply typing the following line in the R console and hit the enter key:

install.packages(x)

6.) Next, click again on "Packages" in the R console and then select "Update Packages...". Like with the new packages command, this can take a few minutes. Once done searching for updates, you will be presented with a list of updated package, you can select all of them, some of them, or none of them as you see fit.

Congratulations, you now have the most up to date packages.

7.) Now close R and return to the desktop, cut the 'Rprofile.site' file from the desktop and paste it back into the 'etc' folder. Close the 'etc' window/folder and you're on your way.

8.) To determine if a new version of R is available, simply point your favorite browser to http://cran.r-project.org/bin/windows/base/

 

Back to the Do it yourself Introduction to R

UNT home page | Search UNT | UNT news | UNT events

Contact Information

Jon Starkweather, PhD

Jonathan.Starkweather@unt.edu

940-565-4066

Richard Herrington, PhD

Richard.Herrington@unt.edu

940-565-2140

Last updated: 03/19/14 by Jon Starkweather.

UIT | ACUS | Help Desk | Training | About Us | Publications | RSS Home