The Epic Search for the Perfect R Text Editor
I can never seem to get exactly what I want from an R text editor. Let me correct that, I can never seem to get exactly what I want from an R text editor on a MAC. I used to use Tinn-R which met most my needs:
- Free,lightweight with an easy install and a slim UI
- Good commenting and code folding tools
- Customizable short cuts
- Support for multiple monitors
- An R console that was separate from the editor
- A flexible, simple, and powerful Find and Replace Interface
- Good SWeave support with some built in LaTeX tools
When I made the switch to Mac I went with StatET on Eclipse StatET has more or less all those things, but it is not simple or straightforward (or maybe just Eclipse is too complex for me). It also has somewhat lousy graphics support and does not allow for fuzzy help searches (??’help’). However, it worked so I’ve been using it. But I just upgraded to R 2.15 and the built in graphics driver (and a few other options) no longer work. I was never that attached to StatET anyway because the Eclipse environment is just too complex for my needs.
I really like R Studio but it’s missing some very key features:
- The ability to Find and Replace on a selection, rather than the whole document, plus general ‘fancy’ text editing find and replace tools
- Multiple monitor support (I’d like to be able to detach one of the panes and move them to another monitor)
- Customizable shortcuts
- The ability to restart the R console without restarting the editor (this I can live without, but it’s nice to have)
So what else is out there? Maybe it’s time to try TextMate? In general I prefer free and cross platform, but I can make exceptions.
Reader Comments (19)
TextWrangler! It's excellent and I think fulfills all your requirements, except cross-platform.
I use notepad++ on Win and Coda on Mac. You might want to try Sublime though, it's cross platform.
Emacs with ESS? The Aquamacs port to OS X comes with ESS ready installed, and there is an all-in-one package for Windows. I use with R 2.15 and on Linux too.
Very customisable, neat interaction with the R shell. The main downside is that emacs has a long learning curve to get the most out of it. But you managed R....
TextWrangler (free) should do it for you (TextMate [paid] is it's older brother). You can install applescript hooks to send code to the Mac's R GUI with a keyboard shortcut, which is nice.
I have to agree with the commenter who suggested Emacs.
Emacs Speaks Statistics is so good for R, that I can never imagine using anything else.
Emacs itself is a little weird, but really flexible and productive once you make some adjustmenets. As a bonus, you can use Emacs for pretty much any other coding or writing you do.
The integration of Tex and R in Sweave files is also wonderful, with proper syntax highlighting, lots of useful shortcuts for common tasks.
Seriously, use Emacs. You really won't regret it.
Hi Frank,
The testing release of StatET is compatible with R 2.15.0
http://lists.r-forge.r-project.org/pipermail/statet-user/2012-May/001408.html
With respect to fuzzy searching there is built-in full-text search available from
within the R Help View (or by using Ctrl+H).
Good luck with your epic search,
Best,
Tobias
I have to add a vote for Vim with the vim-r plugin, which works quite well on Mac OSX. I certainly don't want to start a vim vs. Emacs debate here, they are both fine text editors, I just prefer the sexy, black magic of Vim. In general after teaching a course on R and exploring a variety of editing/runtime environments I still find that no IDE-like environment offers the editing tools I need to code efficiently so I always have turned back to a real text editor married to R with scripting as my solution.
Another vote for Emacs! I was in the exact same boat as you a while back, frustrated by the lack of a good editor that had everything I needed. I knew about ESS, but resisted Emacs for a while due to the learning curve. I finally gave it a shot and it has literally changed my life, much for the better.
If you work a lot with LaTeX/Sweave, I highly recommend getting the AUCTeX package. It improves the syntax highlighting and adds a lot of useful functionality, but doesn't make anything more complicated, if you don't want to use the bells and whistles.
I also *highly* recommend looking into org-mode, which is another killer package that is now coming bundled into most distributions of Emacs (the GNU Emacs v 24 comes with the most updated org-mode version). One of the many lovely features is that you can embed code chunks in a structured document, not unlike Sweave, but you can embed chunks of *any* arbitrary language, not just R. And the R code chunks still leverage all the handy ESS functionality of being able to run the code as you edit. Org-mode itself is a much "lighter" system of markup than LaTeX, but it has fantastic exporting capability, allowing easy export to full LaTeX, ASCII, HTML, and even OpenDocument formats (which even look good in Word).
But even if you don't head down the org-mode rabbit hole right away, Emacs is definitely worth a look as a great general-purpose editor that works beautifully with R.
good luck,
-scott
I'm also a big fan of Notepad++ (along with the plugin NppToR to send code directly to an active console) and would highly recommend the editor for Windows users (it also behaves nicely in Linux under WINE). There's good support for syntax highlighting and auto-completion for R commands, etc.
Stephen Eglen's presentation on all the good stuff: Emacs, ESS, and Org-mode
http://www.damtp.cam.ac.uk/user/sje30/ess11/ess-slides.pdf
My favorite mac editor is TextMate with the R bundle.
Fancy editing feature, Sweave support, highly customizable for shortcut etc...
Best few bucks ever spent. The version 2 still in development promise to be epic!
Ahg, please pardon my brain short circuit above. BBEdit (not Textmate) is TextWrangler's big brother. BBEdit is also an excellent editor, I'm told.
Another twist: if you are considering an iPad in your future, note that Vim is fully supported through SSH (using apps like iSSH).
Big thumbs-up to sublime-text.
I've been an eclipse, jedit, komodo, you-name-it for various languages and platforms. I have been moving to sublime for the last several months and have found the R plug-in acceptable. Sublime is definitely cross-platform (Python-based) and has an active community building extensions.
R-Studio is fantastic but it isn't yet a real multi-pane editor with all of the high-end bells and whistles.
If you're multi-language as I am, an editor/IDE that supports multiple programming idioms is imperative. Having the same control-sequence do the same operations no matter if you are in R, C++, Python, Lisp (commenting, begin/end matching, folding, etc.) is really nice.
Geany is pretty slick and works great with R in the VTE.
Another vote for vi. Switch between editor and console with ctrl-z and fg
Sublime Text 2! It's super fast, great UI and provides great R support by now. With
https://github.com/karthikram/Rtools
you can easily send selected text to the R console and with
https://github.com/jlegewie/SublimePeek
you have direct access to R help from the editor.
I used Eclipse/StatET, emacs/ESS/org-mode, and RStudio, but always seem to come back to Eclipse for the heavy lifting. What I've found hard to replicate in emacs and RStudio is StatET's fast and complete object browser. Visualization of complex list objects, such as SpatialPolygons, SpatialPolygonsDataFrames, data.table, etc.. has great support in StatEt and is a big productivity booster, and great for catching errors early. I know objects can be explored in ESS as well, but it takes a few keystrokes and is tiresome for long hours of coding. StatET R Help browser (using ? or ??) and immediate help on code mouseover, as well as code completion are very nice as well.
With Eclipse you also get code outlines and bookmarks, and very robust search/replace for "free". These features are available in emacs as well, but I tend to forget the keyboard combinations.
Another nice feature of StatET are code snippets that can be executed on any object in the object browser (e.g. if you use custom printing or plotting commands, I also use snippets to quickly import/export tables to clipboard and into MSExcel or into org-mode format, test and build packages, etc..). Snippets can be bound to keyboard shortcuts, so that's another big booster.
StatET also support interacting with remote consoles (R sessions on remote servers), just as if you were working locally. I've found it hard to replicate this feature in ESS.
Emacs is a fantastic all-around code editor and org-mode is light years ahead of Sweave or RMarkdown when it comes to editing structured documents with references, citations, embedded code chunks, and multiple export formats. On Windows Emacs is a bit of a pain though, takes lots of customization to get it right. Then again I really miss a good R object browser in ESS.
Last I tried TextMate on Windows (1 year ago) it also missed a good R object browser and visualization of data.frames and data.tables -- but TextMate is lightweight and much faster than both Eclipse/StatET and emacs/ESS.
A good editor is very needed if you work with huge texts. This information is right for me, because I do the same.
The post is great and I am looking forward to reading your new one and get the information to read it.