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).
- The plugin is available from the eclipse marketplace.
- 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
Once you add that you will be presented with the list of softwares for installation, check WalWare – StatET” and “WalWare – Utilities”.
Complete the Installation. - Before we start using the plugin, we need to install a package called rj
- If you get an error while installing the package try running this on the command line
sudo R CMD javareconf
- 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”
- 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
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.