Installing R and the JGR launcher

R is the name of a powerful statistical package that was developed as "open source," meaning it was built by a community of programmers and is free to use. R extends its functionality though add-on "packages" that you can also download for free. This webpage describes how to install what you need on your own computer, starting from scratch.

1. Download R

You can download the latest version of R by going to http://cran.r-project.org/. Downloads are available for Windows, Linux, and Mac. A setup file for the latest version of R for Windows is available by going here and clicking on the "Download" link at the top.

Windows XP. Go ahead and run the downloaded setup program.

Windows 7 or Vista. You will need to right-click on the downloaded setup program and select "Run as administrator."

2. On Windows 7 Machines, Check Folder Privileges

The next step will be to run a small program called the JGR (Java GUI for R) launcher. When JGR runs, it will want to store a few files that contain "Preferences" information, such as which packages to load by default. On Windows machines, it will look for the default file storage folder, often C:/Users/user although I have sometimes seen it put the preferences in C:/Users/[active username]. Check to see if there is a C:/Users/user folder on your computer. If there is one there, click on it and you should get a "You don't currently have access to this folder. Click continue to permanently get access to it." message. Click continue. If there isn't a user folder, put one there. You will need adminstrator access to do this, so it might not be possible in public labs. Next, right-click on the 'user' folder and select "Properties", then click on the "Security" tab (If there is no "Security" tab, it means you don't have administrator access and you'll need someone else to install the program). Check the boxes next to "Full control" and "Modify." You will need to have administrator access for that as well.

If the permissions of the c:\User\user folder aren't set correctly, the following problems can occur:

  1. JGR is unable to close correctly, returning error messages when you click the "Exit" button, select File -> Quit, or type "q()" (the command for Quit). This is because JGR is trying to access a file in the /user folder but it doesn't have permission.
  2. JGR will restore the workspace from the previous session, which causes problems because that workspace can contain dialog objects that conflict with the ones called using the Analysis menu. To see them, type ls(all.names=T) and look for objects that begin with a period and have the word 'dialog' in them. To get rid of them, type "rm(name of object)", as in "rm(.ezDialog)".

3. Download the JGR launcher

Next, download the JGR launcher, a small program that launches R within a Java environment. Look on your desktop or on Start -> Programs and see if there is an icon of a jaguar eating a letter "R". If there isn't, download it by going to http://www.rforge.net/JGR/index.html and scrolling down to the "Download" section. Look up the launcher for your operating system and download it to the desktop. If you have Windows XP, you can just double-click that program, but if you have Windows 7 or Vista, you will need to right-click the file and select "Run as administrator." So long as the setup of R went correctly, the JGR launcher should open a console window and begin downloading the packages it needs for JGR to run and then opening R.

4. Download R Packages

Now that JGR (pronounced "jaguar") has been installed, you should be able to double-click it when you want to open R. R comes with many base functions, but you will need to install some add-on packages to extend its functionality. If you have Windows 7 or Vista, you will need to run JGR "as administrator" if you want to install packages (right-click on JGR and select "Run as Administrator"). If you are an administrator and you're installing this in a public lab and you want users to be able to install and update packages on their own later, you'll need to change the ownership of the "library" folder in R and then set its permissions to "Full." Here is a webpage that steps you through that process (tip: in step 6, "Everyone" works as a group name). To install packages, you will be typing into the R console that opens when you start JGR. Below are the commands to enter. I have numbered them, but don't enter those numbers themselves when you type.

  1. install.packages("Deducer", dependencies=TRUE)
    This downloads the Deducer package and all the other packages that it uses (its 'dependencies'). There are a lot of them. The first time you execute "install.packages", JGR will ask you which CRAN repository you want to use. This is where you'll be downloading the files from, so I'd recommend choosing someplace close to you (at least in the same country). If you try one location and there is a problem or the connection is very slow, you can select a new repository with the command chooseCRANmirror()
  2. install.packages("Deducer",repos="http://rforge.net")
    This downloads the latest 'development' version of Deducer. It contains code necessary for the 'DeducerRichOutput' package to run.
  3. install.packages(c("DeducerRichOutput", "DeducerAlpha", "DeducerReshape", "DeducerANOVA", "DeducerPSY220"), repos = "http://R-Forge.R-Project.org")
    This downloads 5 packages that I wrote. The first converts R output to HTML (which is prettier), the second allows you to compute Cronbach's alpha, the third is a data manipulation tool tailored for within-subjects designs, the fourth adds analysis of variance capability, and the fifth contains several useful data sets and a paired t-test analysis tool.

5. Load Packages

"Installing" a package just downloads it and puts it on your hard drive. You also need to "load" the package to actually use it. Once you've got the packages installed, you can click on the "Packages and Data" menu in JGR and select "Package Manager". This opens a window listing all of the installed (downloaded) packages, including the ones you've just installed. There are 2 columns with checkboxes, and the columns are labeled "loaded" and "default". Any package that you check under "default" will be automatically loaded the next time you start JGR. That will save you some steps, so I'd recommend clicking the boxes for both "loaded" and "default" for all the packages that begin with "Deducer". You will also need to click the two boxes for the package called 'stringr'.

I've started a TroubleShooting page for problems and solutions not addressed above.

If you have problems, please feel free to email me: altermattw@hanover.edu. Be sure to include any error messages generated by R in your email.