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:
- Syntax highlighting
- Highlight matching brackets
- Code outlines
- Comment toggling
- R console integration
- Integrated documentation with Sweave or Roxygen
- Project explorer
- Task management
- Source Code Management integration (both CVS and SVN)
- A single environment for all languages (e.g. C or Fortran development for R packages)
Here are the basic steps:
- 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).
- 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:
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.