EDIT: Completely ignore the advice below. R Studio is now the way to go for an R development environment. It was a viable alternative about a year after I wrote this post, and now it’s hands down the only way to go.
About StatET and Eclipse
StatET is a powerful plug-in that allows you to use R inside the Integrated Development Environment (IDE) known as Eclipse. The features in Eclipse make it easier to write code in R, unless perhaps you’re already using something more sophisticated.
Eclipse has a reputation for having a “steep learning curve”. However, I have found it to be useful even if you barely know what you’re doing. The more you learn, the more useful it becomes.
StatET has a reputation for being difficult to install. There are a few things that tricky for non-programmers. Hopefully this post will make those things more obvious.
StatET is written by Stephan Wahlbrink. The official website and more detailed instructions can be found here: www.walware.de
I will be showing you how I installed the plug-in for Eclipse Indigo, using R 2.14.1. I’m using a Windows XP machine. The process is similar for Windows 7.
- Update R libraries. I’m going with the most recent StatET version, and following the steps exactly from walware.
The first line of code was just to make sure that I didn’t already have it installed.
install.packages(c("rj", "rj.gd"), repos="http://download.walware.de/rj-1.0")
- Now that R is ready to go, download Eclipse. It’s free, just Google “Eclipse”. I downloaded the first link, which looks like a Java version, but it’s really just a general version of Eclipse.
- The actual Eclipse installation is easy. You just unzip it anywhere and use it. I put it in C:\Eclipse and copied a shortcut to Eclipse.exe to my desktop. I also created a separate folder for my workspace (but I don’t use the workspace folder much).
- Once Eclipse is installed and running, you need to install the StatET plug-in, which is very easy (if you know how).
This is the place you go in Eclipse to start the install:That will give you a place where you can put in the web address (
http://download.walware.de/eclipse-3.7) that contains the code for Eclipse:
NOTE: Only select the StatET folder! Choosing extra options may cause problems later.
Run that, accept terms, etc, and restart Eclipse when it asks you to do so.
- Now, you follow the built in guide. When you restart Eclipse it should look like this:
Click on the first part of the guide “Configure and Launch an R Console”, this will start the guide.
- Once the guide has started, it should look like this:My first time I didn’t notice that you click on the little “click to perform” or “click to skip” links to navigate the guide (maybe it’s more clear now, I don’t remember). In any event, click on those to step through the guide.If this is your first time, skip the first step. This lets you run R in other ways, but you probably just want to run R inside Eclipse for starters.
- The next big step is where you specify the “R HOME” variable. This is just a way of telling Eclipse where you keep your version of R.
When you click on the “perform” button in the guide (or “re-do” if necessary) it’s just a shortcut to opening up the options menu, which you will hopefully use many more times on your own. You can get back to the preferences through the menu in Eclipse by selecting Window > OptionsTThere are a lot of options in Eclipse. Luckily you can often find what you want through the search feature.Anyway, choose the folder that has your R installation as your “R_HOME”. You can paste it into the menu, or choose it by clicking on “browse file system”.
NOTE: R_HOME is a a sub folder of Program Files \ R, but not the actual place where R.exe is located. My location is “C:\Program Files\R\R-2.14.1” (not the bin folder).
NOTE: Also you use “\” in the path here, since this is Eclipse and not R yet. As you may know, R only accepts “/” in path specifications.
- Getting close! Now, you have to tell Eclipse how you’re going to start R, this is like making a shortcut. You do this by selecting run configurations…
- create an entry for “R Console” by double clicking on “R Console” (or right clicking and choosing “new”)You can link to your R installation here, but you’re linking through Eclipse. You can also specify start-up options and declare globals if you’d like. This is a little unnecessary, but I did add “–no-save” as an option because I don’t want Eclipse asking me if I want to save my R Workspace every time I close R.
Now, choose Run. This should start a session of R in Eclipse!
- One last thing: You’ll be prompted with this menu:I believe this is referring to the help files, and I choose the global option. StatET will take a while to load the first time because it’s compiling the Help files for the first time for all the packages that you have installed.
Once it’s working there’s still some work to get it set up the way you want it.
My console is below, but this is before I’ve started moving windows around to make it easier to navigate.