Skip Navigation Links
Tinn-R: A Convenient Script Editor for R on the Win32 Platform
Link to the last RSS article here: RSS FAQ - Ed.
By Dr Rich Herrington, ACS Research and Statistical Support Services Consultant
The S language was designed to translate statistical ideas into software implementations quickly and faithfully. In recognition of the success of this endeavor, the Association for Computing Machinery (ACM) presented their prestigious Software System Award to John Chambers, the principal developer of the S language. The implementation of S that we will concern ourselves with here is the GNU version of S - R. R is a cross-platform statistical programming environment that is increasingly evolving into a system that is closely integrated with the underlying operating system environments on which R is maintained. On Unix and Linux platforms, many IDE applications are available to choose from (IDE - integrated development environment or source code editor). Text based editors can be used for editing the R scripts: Emacs is one such editor; Vi is another popular editor for UNIX based systems. However, an IDE provides further enhancements such as color coding of syntax; a pager or execution shell that allows concurrent compiling and debugging of source code; the ability to paste in code templates for the different language constructs (e.g. loops; case-statements, etc); to name a few. Here, we discuss Tinn-R, a Win32 based GNU project (see SourceForge project page) that serves some of the purposes of an IDE for the R console on the Windows platform.
The R Script Editor
R comes with a built in script editor (from the R console go to the File-New Script menu entry). Invoking the script editor produces the following:
To use this editor, a script is typed into the R Editor (or a script file is loaded). Then a user selects the R script in the R editor window (i.e. mouse select and drag operation of the relevant R script). Finally, a right mouse click and selection of "Run line or selection" produces output in the R console window. For example, the red and blue output in the R console is produced below:
The R editor that is integrated into the R Windows installation is a fairly basic and feature-less editor - a far cry from an IDE. However, the Tinn-R editor is an indispensable helper tool for users of R on the Windows platform.
The Tinn is an editor under development under Borland - Delphi 5. Tinn-R is licensed under GPL (GNU Public License) and can be downloaded from the SourceForge project Page. Tinn-R contains enhancements to allow syntax highlighting of S language. Additionally, Tinn-R interacts with the R console and submits code in part or in whole to R directly:
For example, the following produces output in the R console:
Some of the general features of Tinn-R are: syntax highlighting for R code as well as many as 20 other languages; bracket matching; project management (with multiple files); copy code with syntax coloring in RTF, HTML or TeX; and Tinn-R can act as a TeX compile shell. A major advantage of using Tinn-R is that if R crashes (which does happen rarely), one doesn't lose all of the R code that has been written but not yet saved to file. Another advantage is that one can return to Tinn-R and continue writing R code while is performing computations. A nice tutorial on downloading, installing R and Tinn-R can be found at: http://mcs.une.edu.au/~Rguide/Rnotes.pdf (a local copy is housed here at RSS).