IDE: Eclipse (StatET)

There are many IDE's (Integrated Development Environments) for R.  So it is up to each developer to choose what's most important.  My personal favorite is Eclipse (see the wikipedia article).  Eclipse was originally created for Java development, but has become one of the most widely adopted IDE's for all languages at this stage thanks to it's architecture, which allows to easy extension through plugins.  For instance, Insightful created a new S-Plus GUI using Eclipse (which they call the S+ Workbench).

I show how to set up and use Eclipse for R development.

Eclipse offers many benefits over the basic R GUI.  Some examples:

  1. Syntax highlighting
  2. Highlight matching brackets
  3. Code outlines
  4. Comment toggling
  5. R console integration
  6. Integrated documentation with Sweave or Roxygen
  7. Project explorer
  8. Task management
  9. Source Code Management integration (both CVS and SVN)
  10. A single environment for all languages (e.g. C or Fortran development for R packages)

Using R in Eclipse requires the "StatET" plugin from WalWare.  Longhow Lam has written a nice guide for this, but I'm just going to go through the basics.

Here are the basic steps:

  1. Install Eclipse from http://www.eclipse.org/.  You can choose whichever version suites your needs (e.g. the version for Java developers, or C/C++ developers).
  2. Once Eclipse is fully installed, open it.  We're going to install the StatET plugin.  Go to Help > Sofware Updates > Available Software (tab) and click the "Add Site..." button.  Enter this URL: http://download.walware.de/eclipse-3.4 (assuming you're using Eclipse version 3.4).

Once StatET is installed, you need to configure it.

  • Add your R installation: Window > Preferences, and expand the "StatET" list.  This has many different settings available.  Expand the "R Interaction" list, and select "R Environments".  Click the "Add..." button, and enter the path to your R installation (e.g. "C:\Program Files\R\R-2.9.0).  You can add multiple R configurations if you're using different versions, are compiling your own version of R, or using alternative R versions like "Ra".
  • Decide how you want to interact with R: Click on "R Interaction" and chose from the drop down whether you want a console within Eclipse or to use the R-GUI.  I prefer to run a console within Eclipse.

Now, to start using R in Eclipse, you can either start a new project or open an existing one.  Let's just assume that you start a new one by going File > New > New R-Project and following the steps.  Right click on the new project folder and select New > R-Script File.  Type some R commands into the new R document and save it.  For instance, you could type the following example:

LETTERS
data.frame(code=rnorm(length(LETTERS)),letter=LETTERS)

Now highlight the lines, right click, and "run selection in R" (you can also use the shortcut CTRL-R, CTRL-R).  You will see the lines executed in the R console.

Be Sociable, Share!

2 thoughts on “IDE: Eclipse (StatET)

  • Tal Galili

    Hi there,
    I just came across your blog (through the link in learning R), and would like to invite you to add your blog to R-bloggers.com
    http://www.r-bloggers.com/add-your-blog/

    (Please make sure you have a category or tag with which you always use, only when writing about R)

    Also, a few blog suggestions:
    1) use the plugin subscribe to comments.
    2) add a "contact me" page, with either giving your e-mail or with the plugin "contact form 7"
    3) change your about in the sidebar.

    And a side note, consider also linking back to R-bloggers so other will know about it (share readers to get readers...)

    Many good lucks to you :)

    Tal

  • human mathematics

    So I use gEdit (syntax highlighting for scripts) and Rstudio -- which has the benefits you mentioned of Eclipse and more. For client reports I use LyX and Sweave -- that seems like a good combination to me.

Leave a Reply

%d bloggers like this: