Installing R and RStudio

R and RStudio are both free, open-source software, available for all commonly used operating systems, including Windows, Mac OS X, and Linux systems. R and RStudio install in the standard manner on each of these systems. System-specific instructions for installing R are given below. Regardless of your operating system, you should install R before installing RStudio.

Please read and follow these instructions carefully.

Installing R on Windows

bulletIt is best to download R from the closest Comprehensive R Archive Network (CRAN) mirror site, which in our case is the mirror at the University of Toronto. Click on the link Download R for Windows, which appears near the top of the page; then click on install R for the first time, and subsequently on Download R 3.0.2 for Windows (or whatever is the current version of R). Once it is downloaded, double-click on the R installer. You may take all of the defaults, but I suggest that you make the following modifications:

bulletInstead of installing R in the standard location, C:\Program Files\R\R-3.0.2, I suggest that you use C:\R\R-3.0.2. This will allow you to install packages in the main R package library on your computer without running R with administrator privileges and will avoid problems that sometimes occur when there are spaces in paths.

bulletIn the Startup options screen, select Yes (customized startup). Then select the SDI (single-document interface) in preference to the default MDI (multiple-document interface); feel free to make other changes, but you may take all the remaining defaults.

Installing R on Mac OS X

bulletIt is best to download R from the closest Comprehensive R Archive Network (CRAN) mirror site, which in our case is the mirror at the University of Toronto. Click on the link Download R for (Mac) OS X, which appears near the top of the page; then click on R-3.0.2.pkg (latest version) (or whatever is the current version of R). Once it is downloaded, double-click on the R installer. You may take all of the defaults.

Installing R on Linux Systems

bulletIt is best to download R from the closest Comprehensive R Archive Network (CRAN) mirror site, which in our case is the mirror at the University of Toronto. Click on the link Download R for Linux, which appears near the top of the page. R is available for several Linux distributions (Debian, RedHat, SUSE, and Ubuntu); select your distribution, and proceed as directed.

bulletIf you have a Linux or Unix system that's not compatible with one of these distributions, you will have to compile R from source code; the procedure for doing so is is described in the R FAQ (frequently asked questions) list.

Installing RStudio

bulletGo to the RStudio IDE home page and click on the Download RStudio button at the upper right; then click on Download RStudio Desktop. The RStudio website should detect your operating system (Windows, Mac OS X, or Linux); click on the link for the current release of RStudio for your system.

bulletOnce it is downloaded, run the RStudio installer and take all of the defaults: In Windows, double-click on the RStudio installer to start the installation; in Mac OS X, double-click on the downloaded RStudio disk-image file, and drag the RStudio icon to the Applications folder.

bulletWhen you first run RStudio, it should detect your R installation and start the R 3.0.2 console. To configure RStudio to your taste, select Tools -> Options (Windows) or RStudio -> Preferences (Mac OS X) from the RStudio menus. If you encounter difficulties, consult the RStudio troubleshooting guide.

Installing R Packages for the Course

bulletOnce you have installed R and RStudio, you can install additional packages required for the course by typing the following command at the > command prompt in the R Console (and pressing the Enter or return key):

install.packages(c("car", "effects", "knitr"))

You may be prompted to select a CRAN mirror site. Alternatively, you can install packages from the RStudio Packages tab.