R Sessions 26: Text editors for R: Internal editor on OS X


Since R-Project is essentially syntax based, one needs a good text editor to write some code before it is executed in R. And, since we are all writing high quality code, we need a high quality text editor. This is the first in a series on text editors for using with R-Project on MacOSX.

The first editor to look at, is the internal one. The Mac OS X version of R-Project comes with quite a strong, although basic, text editor. It is shown in the picture below, where it is being used to edit a fragment of code of my own. We readily see some syntax coloring, which is a great help regarding the readability of the syntax (syntax colouring is only available in the Mac OS X version of R-Project). Also, on the top of the window, a drop-down list is shown, which now shows `dp.HI.cook’, which happens to be the name of one of the functions that is defined in the syntax file. By clicking one of the items in this drop-down list, the cursor automatically jumps to that section of the file, allowing for fast and easy navigation. As to be expected, the code can easily be send from the editor to the R prompt, where it is executed.

To my liking, this editor is just a little too light-weight. It does a nice job colouring the syntax and such, but it lacks on other features such as advanced find & replace, or management of multiple files. If you’re editing more than a single file, you will be doing it in more than a single window, which might be a little inconvenient. Also, when working on large files for a longer period, I found that at times the text wasn’t rendered any-longer. I then had to save and re-open the file. Also, working on long files can be a tad slow, for it seems that the text-colouring tends to run behind easily.

Nevertheless, having your text editor integrated in R-Project does have one strong advantage: the syntax help provided by the Mac OS X version of R-Project is also shown in the editor. So, if you type the name of a function and the opening bracket ‘(‘, you immediately see all the pre-defined parameters to that function. This greatly reduces the necessity of using the help-pages and is provided by only a very few of the external editors.

All in all, the internal editor of R-Project is not bad at all, particularly on Mac OS X. For simple analyses and writing or editing of some small helper functions, it suffices. However, for more serious projects it will soon prove to be too ill equipped. Fortunately, we have some excellent external text editors for this, some of which will be discussed in the upcoming R-Sessions.

– – — — —– ——–

– – — — —– ——–
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.
——– —– — — – –

Leave a Reply