System setups for working with R

Once you have R installed and functioning, you need to develop a way of working with R. One of the major choices is what editor to use. There are many possibilities, some are better suited to teaching, where ease of setup and use are paramount, others are better to suited to intensive R users, for whom spending time on learning a more powerful system can be well worthwhile.

FIXME: add some descriptions of system setups here. Note the system they apply to (Windows, Linux, Mac OS X), and their advantages (e.g., ease of setup, simple use, powerful capabilities, etc.)

Simplest Windows Setup

Use the simple editor built into the R gui to edit functions and scripts.


> fix(x) # to edit the definition of a function, or a data frame
> edit(file="script.R") # edit a script
> source("script.R") # source the commands in a script


  • no additional programs need be installed
  • very simple editor


  • editor is not very powerful

Windows GUI + other editor

FIXME: mention some other editors that can be used


is a tiny editor, very easy to use, and can be used on remote connections (like nano and vim). It has syntax highlighting for c and Fortran, but not for R ... Its Internet page links to many text editors, with memory requirements varying in a 1/1000 ratio. It can be installed and successfully tested on GNU/linux and Windows + Cygwin by compiling from source, or, with Mandriva2010, with binary packages *.rpms (but, under Cygwin+Xterm, it does not clear the screen ; binary installs from a recent (March,2010) Cygwin do not have this issue). Though Joe cannot syntax highlight R sources, it can highlight (at least) c, fortran, shell and diff files (the latter case is the output of diff, which shows the difference between two versions of (sets of) file(s))


is an intuitive program editor, and might interest people who want to use the same easy editor under Linux and under Windows (, for programs in many languages.

However, it is not very known, though actively maintained, and has no syntactic highlighting for R -at least for its 2004 Windows version- (C or csh syntax highlight can be a workaround....)Else, it might be a replacement for ConText. It supports (like context and vim ) brace/parenthesis matching, copying and cutting from and to the R GUI (under Windows) and can be launched from the R console(or from a script) by a command like :

system('c:/ProgramFiles/ScintillaTextEditor/SciTe.exe t.R',wait=F)

Under a recent GNUlinux (Mandriva 2008.1, with its full developpemt headers) Scite + Scintilla version 1.7.6 offer a visible R syntax highlighter. Installation is likely to be by compiling from sources, and care should be given to the places one installs it.


For those who like vi (a common Unix editor), vim provides a superset of features, a powerful scripting language, about 2,500 add-on scripts, an active community, a nice tutorial (downloaded with vim under Windows; some GNULinux distributions also ship vimtutor) and is available on all R platforms.

Syntax Highlighting. vim is already configured with R syntax highlighting on all platforms; however, on certain non-Windows platforms the syntax highlighting may not be activated even though it is there so enter “:syntax on” (when _not_ in insertion mode...) to activate it for the session. Alternately, for platforms where it is not already activated, it can be automatically activated for every session by placing:

syntax on

in your .vim or _vimrc (on Windows) startup file. (From within vim “:echo $HOME” will display the directory where this startup file goes.)

Sweave. For Sweave syntax highlighting in vim see: link.

vim to R. There are a number of solutions for sending information from vim to R. vim script 1048 (all platforms but needs perl), script 2104 (Mac) and clip2r.js (Windows) or this r-help post (Windows). Also see this page from Johannes Ranke for more information.

Cream is a set of vim configuration files which makes it as beginner-friendly as modern text editors, with the opportunity to revert to the standard vim (in settings ->expert mode)

Emacs + ESS

Vincent Goulet has a nice version of Emacs for Windows that includes ESS, AuCTeX, aspell.

Context (Windows only)

Context is a lightweight editor for Windows with some nice features including syntax highlighting and interacting with an R process.

To install the syntax highlighting plug-in for R, click here and navigate to the plug-in for ‘R script’. Download the highlighter and install it. For example, it is usually installed to

C:\Program Files\ConTEXT\Highlighters

Note: Context is currently (Nov 2007) freeware, but the code is for sale and this may change.

codeblocks (Linux and Windows)

code::blocks can be used as an editor under Linux and under Windows : it offers syntax highlight (from the GUI, once a file is loaded, choose Edit -> Highlight mode ->C/C++) , code folding (one may hide/unhide code between “{” and “}” : only the first line of the block remains visible). If R files (with a .R suffix) cannot be loaded, one may either: install the contributed plugins from ones distribution or compile codeblocks from source ( this is not more complicated than building R , once wx is installed ; by default, at configure step, *all* the plugins are allowed... some distributions only allow some of them, to make it lighter).

Tinn-R (Windows only)

Tinn-R is a simple editor that provides tools to control Rgui. It is a feature-rich replacement of the basic script editor provided with Rgui, providing syntax highlighting, submission of code as chunks or line-by-line, and many other tools to ease writing and debugging of R code.

One disadvantage compared to Emacs is that Tinn-R does not support code folding.

Tinn-R is distributed under the GPL 2 or above license.

"Help" and "General Discussion" Forums

Download Tinn-R from SourceForge

Tinn-R web page at Sciviews

Linux Specific : Kate and Kwrite

Kate is a text editor with syntax highlitening (by changing fonts and colors); R’s syntax can be recognised (2.5 denotes Kate’s version), and it might be called either from a right click from the desktop browser (then, choose : Kwrite at least under KDE), or by typing :

kate ../litcontours.R # assuming the file is named litcontours.R and kate is in one's path

Nota : even if a message like :

WARNING: please edit ~/.scim/global and change /DefaultConfigModule to kconfig
Uh oh.. can't write data..
db@n011:~/Scintificcomputing> less ../litcontours.R

appears, the file is really modified....

getting-started/system-setup/system-setup.txt · Last modified: 2010/03/30 by dbrion1
Recent changes RSS feed R Wiki powered by Driven by DokuWiki and optimized for Firefox Creative Commons License