My two favorite IDE’s for R – tips & tricks

May 20, 2012
By

(This article was first published on G-Forge » R, and kindly contributed to R-bloggers)

The two IDE that I use for R are RStudio and Eclipse with StatET. They complement each other nicely, RStudio works out of the box while I previously shown how to get Eclipse & StatET going, you can find it here, which is slightly challanging.

RStudio

I use RStudio for all my statistics where I don’t want to create functions or more advanced programming. It’s great since it allows me to get immediate help, code completes the initiated variables. The settings are simple and you hardly need to do anything.

My favorite RStudio shortcuts:
<Alt>+<-> gives the assign operator <-
<Ctrl>+<Alt>+<Left/right arrow> switches between open files
<Ctrl>+<Space> gives autocomplete options
<Ctrl>+<Left/right arrow> jumps one word

The main downside to RStudio is it’s lack of autocomplete inside functions. You can find a very nice “complete” manual here.

Eclipse with StatET

I use Eclipse for a lot of programming. I mostly program in R, Python, JavaScript and PHP. The advantage of having one IDE is that it’s faster to switch between the different “Perspectives“.

After you’ve set up Eclipse & StatET I recommend adding some tweaking. Open the Windows > Preferences:

Search for “editor“, remove the binding <Ctrl>+<F6> and enter your own. I like <Ctrl>+<Tab> for next and <Ctrl>+<Shift>+<Tab> for previous editor.

Another setting that I like is using the R console proposals, you can find that in the same Preferences popup, make sure the “All R Console Proposals” is checked:

You also need to put some effort in getting the tools working. Click on the run box with a brick on it:

At first the list is pretty empty so you go into External Tools Configurations…

Now you need to setup the double click or click on the new icon to add the commands that you want to use:

Name the command and choose it from the drop-down list. Then go into R config tab:

And select the working directory for the command. This is important if the function creates new files because otherwise it tries to do that under the C:\Program\Eclipse folder and usually it will complain about not being allowed to do that.

These run tools are very convenient but remember to select the project in your Project Explorer or Eclipse will throw an error: Variable references empty selection ${resource_loc}. This is of course pretty obvious but I’ve found that Eclipse is very picky about the right window being highlighted and that sometimes you actually have to click twice on the project.

My favorite Eclipse shortcuts:
<Alt>+<Tab> see how I set switch between editors/file
<Ctrl>+<Space> gives autocomplete options
<Ctrl>+<Left/right arrow> jumps one word

To leave a comment for the author, please follow the link and comment on his blog: G-Forge » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.