R-Sessions 27: Text Editors for R: Textmate

R-Project works best with a good text editor that is well integrated with R-Project. This edition of the R-Sessions will focus on TextMate, a paid application marketed as ‘The Missing Editor for Mac OS X’.

Designed explicitly for use by programmers on Mac OS X, TextMate makes a promising first impression. The interface looks very clean, text is rendered perfectly, and syntax colouring is provided for quite a large number of programming languages. Also, the colouring of the syntax looks very nice, by the use of light colours that don’t interfere with reading the text.



R-Project integration is not standard, but is installed rather easily. It requires a little tinkering in the Terminal, but I don’t expect many users of R-Project to scare away from that. TextMate uses so-called Bundles to provide integration with and definition of many programming languages. The bundles also provide short templates of often used functions. A list of bundles is made available here (amongst which one for R-Project, and instruction on how to install TextMate bundles is found here.

The R Bundle sends the whole file, or just a selection, to the R prompt swiftly. It also sends a command to set the R Working Directory to the path where the executed syntax is located. I fail to understand why, though, and found it sometimes a little annoying when scrolling back though my output and finding the working directory set between almost every command.

TextMate is full of nice, little details. Row numbering, marking specific rows for future attention, manually setting the number of spaces for a tab, adjusting the way syntax is coloured, and tabbed viewing of multiple files: it’s all there, and it is all executed properly. Also, loops and other nested syntax (such as function definitions, which is often used when working with R), can be collapsed, so that only the first row remains visible. Using this clears up complex syntax in a breeze.

The most important feature to me, however, was using the Project Drawer. As the image below shows, this sums up several of the files you’re currently working on. The collection of files can be saved as Projects, so you can continue working on them at later stages. The Project-file only contains references to the actual files, so the text-files will always remain accessible by other applications. More importantly, you can even manage the physical files from within TextMate: when you delete a file from the Project Drawer, you can choose to delete only the reference to the file, or to move the actual file to the Trash, as well. Of course, new files can be created from within TextMate as well.

Overall, TextMate is a very solid text editor. It integrates with R-Project reasonably well, colours the syntax much better than the internal editor of R-Project, and provides strong functionality in the form of project management. By using extension bundles, it can do much more than syntax editing for R-Project, but when using it for that purpose only, I find the price (€48.75 at the time of writing) a little too steep. Also, the closed source of the software may not appeal to some users of the open-source R-Project. Therefore, the next R-Sessions will focus on some open-source and / or free alternatives, that appear to be at least as good.

- – — — —– ——–

- – — — —– ——–
R-Sessions is a collection of manual chapters for R-Project, which are maintained on Curving Normality. All posts are linked to the chapters from the R-Project manual on this site. The manual is free to use, for it is paid by the advertisements, but please refer to it in your work inspired by it. Feedback and topic requests are highly appreciated.
——– —– — — – -

Latest Comments

  1. Jake says:

    “Therefore, the next R-Sessions will focus on some open-source and / or free alternatives, that appear to be at least as good.”

    Where’s the open-source text editor section?

Leave a Reply