Running R from Eclipse – StatET installation and Usage

Many developers, especially the Java developers are quite comfortable using eclipse for development. There is a very useful and powerful plugin called StatET that can enable eclipse to work as in IDE for R. Lets first look at how to install it on Linux(Ubuntu).

  1. The plugin is available from the eclipse marketplace.
  2. The eclipse update site is http://download.walware.de/eclipse-4.5. For other versions check the Installation page at StateET site. To add it via eclipse go to Help -> New Software ->Add and write as shown below
    Selection_133
    Once you add that you will be presented with the list of softwares for installation, check WalWare – StatET” and “WalWare – Utilities”.
    Selection_088
    Complete the Installation.

  3. Before we start using the plugin, we need to install a package called rj
    Selection_138
  4. If you get an error while installing the package try running this on the command line sudo R CMD javareconf
  5. Once the package is installed go back to eclipse. We first specify R home here. Go to Windows->Preferences->StatET->R Environments.
    Click on ‘Add’ to add a new environment and add the location for R_Home. Click on “Detect Default Properties/Settings”
    Selection_136
  6. To run R commands or an R file, we first need to start and R Console from eclipse. To do that we create a Run Configuration. Go to Run Configurations and create a new “R Console” configuration
    Selection_137
    Click on Apply and then Run.

That’s it!. You have now successfully installed StateEt plugin. Create a new R Project and a new R file. You can then run the whole file in R or select the code that you want to run and then click on the symbol that says “Run Selection in R”. If you dont see the commands then you might have to go to the StatET perspective. The R Console is normally at the bottom and shows the R commands as they run. You can also create plots and view them in eclipse (it opens up an R Graphics window)

There is another window on left called “object browser” and shows methods from all installed packages. It also shows the Global Environment and all objects in that environment. That can be Very useful.

Bitnami