Installing R

Installing the Base Package

Go to the CRAN website to download the precompiled binary distributions for the base package of the latest version of R for your operating system (the top box on this webpage).

Current versions install both a 386 and 64x flavor. Just use the 64 if you have a 64-bit system (which is most likely).

If you are using Windows Vista, read about these special issues

Recommended Packages for Curtin Laboratory and PSY610/710 Students

The following additional packages should be installed from CRAN by Curtin Lab users and PSY610/710 students
car, foreign, MASS, psych, sciplot, gplots, pwr, gvlma, relimp, lmSupport, effects, mediation, Hmisc, lme4, AICcmodavg, pbkrtest

These packages can be installed with the following command in R:
install.packages(c(‘installr’,’car’, ‘foreign’, ‘MASS’, ‘psych’, ‘sciplot’, ‘gplots’, ‘pwr’, ‘gvlma’, ‘relimp’, ‘lmSupport’, ‘effects’, ‘mediation’, ‘Hmisc’, ‘lme4’, ‘AICcmodavg’, ‘pbkrtest’, ‘plyr’, ‘reshape2’))

Important notes about installing packages: When installing new packages for R, make sure to install them from R (not RStudio). RStudio does not always install the packages to the correct directory. If prompted, Windows users should install their packages to a personal library. If you do not install your packages to a personal library, you will not be able to update packages when new releases come out.

Configuring R settings via RProfile

An R profile can be used to customize your R experience, from specifying default statistical output, to pre-loading frequently used packages (although as of May 2017 it is no longer set up to load any packages). You can use the lab file (linked below for each platform) if desired, but it is not required.

Windows users: You should replace your RProfile.site configuration file with this one to establish our default R settings. The RProfile.site file is saved in the etc folder in your R installation.

Mac users: You should replace your RProfile.site configuration file with this one to establish our default R settings. Save this file in your home folder (ie: ‘/Users/HomeFolderName/’, in Finder under Places it is the folder with the icon of a house). It must be renamed to “.RProfile” to work. If it is saved as a “RProfile.txt” file you will have to rename it through the terminal. In the Terminal type (NO QUOTATION MARKS) “mv RProfile.txt .RProfile'” and hit return.

Scripting environments

RStudio provides a “MatLab”-like scripting interface that neatly organizes the R Console, workspace, working directory, and script editor into one nice package. RStudio works for both Windows and Mac machines. It is also currently in beta, so there are a few bugs and issues that need to be fixed in the current version. Prominent among these is that RStudio only allows the display of one graphical device at a time, and so will throw an error after a call to dev.new, windows, or quartz. This means that some functions in a few commonly-used packages (like lm.modelAssumptions from the lmSupport package) do not work in the current version of RStudio.

Updating R

Updating R can be a bit of a pain. The updateR() in the ‘installr’ package makes it painless. For for documentation on how to install and use this package read this blog entry on the R-statistics blog.