Which text editor to use with R?

Although some users would prefer a graphical user interface for R, the arguably best way to work with R is through the command line. This can be done directly in the R console, but often it is more convenient to write scripts in a separate file, instead of typing them directly in the console. This requires a text editor, and you can of course use the default one that comes with your OS. However, there are text editors that offer different levels of integration with R. Below are the ones I tried.

Before switching to Linux my preferred text editor was Tinn-R, an easy to use text editor that integrates nicely with R. I highly recommend it when using R in Windows. Other options are to use one of the GUI for R, which often offer an integrated text editor too.

After switching to Linux, I started out with Gedit which comes as default in Ubuntu. It includes syntax highlighting for R, but it misses an important features a better integration with the terminal. Update: There is the plugin RGedit allowing it to interface with R and to become, thus, a simple and light-weight IDE for it. See also this post.

A text editor which does have both features is Kate, the default text editor of KDE (you’ll need to install Konsole too). You can send selected code directly to the terminal through the Tools menu -> Pipe to Terminal. However, to make most use of this feature, you should assign a shortcut, which can be done in the Settings -> Configure Shortcuts. Highlighted text can be exported as html through the menu File -> Export as HTML.

Update: Another editor you might want to try out is Jedit. It is a versatile programmer’s text editor with an integrated terminal, so you can run R from within the text editor. It’s written in Java and therefore cross-platform.

An even better integration is offered by RKward. It includes a console similar to the R text console, and a script editor, both which offer syntax highlighting and auto completion of R symbols and functions. Like in Kate, highlighted text can be exported as HTML. There is also an object browser; very convenient when working with many objects and functions, an easy way to manage and install libraries (packages) and a built-in data frame editor. As added bonus, it includes a menu which provide access to some functionality in R. They do so by generating R syntax from settings made in a graphical dialog, which can be of great help for users less familiar with the R syntax. It is available for Linux and Windows, although for the latter it is still much a work in progress.

Edit: you should definitely check out Rstudio, a very user friendly R interface, somewhat similar to RKward, but easier to work with and it runs both on Windows and Linux. Another option I should add is JGR. Like Rstudio, it offers a graphical interface that integrates a text editor and the command line console.

I might try out other options in the future, like Emacs with ESS (“Emacs Speaks Statistics”). For now however I am using RKward (while occasionally using Kate) RStudio almost exclusively.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s