R user interfaces

R’s default user interface

R console

Command prompt

>

For interactive data analysis: type in commands, hit Return key and get text output as a result.

1+7
[1] 8

Comments start with #, they are not executed as a command

9 * 3     # this is a comment
[1] 27
  • Copy and paste to and from the clipboard as usual (Windows: Ctrl+c and Ctrl+v)
  • Interrupt R with ESC (on Windows) or Ctrl+c (Linux)
  • Quit with q()
  • Save a protocol of your commands and the output with sink("fileName.txt", split=TRUE)

Non-interactive use

For batch mode:

Rscript.exe input.r

Rterm.exe --no-restore --no-save < input.r > output.txt

Get and set options

getOption("width")
[1] 75

Change option, save previous value, and restore previous value

op <- options(width=70)
options(op)

Also see help(Startup) for files controlling the startup options.

Contributed user interfaces to R

Compared to the standard user interface that is already included with R, there are several better alternative options.

For working with R commands

  • RStudio integrated development environment: Cross platform (Windows, MacOS, Linux), great support for the workflow for these posts, my preferred choice
  • Eclipse integrated development environment with StatET plugin: Cross platform (Windows, MacOS, Linux), powerful, visual debugging support, somewhat complicated to set up (installation instructions), somewhat sluggish on older computers
  • Architect by OpenAnalytics: Combines Eclipse and StatET into a pre-configured bundle that removes the complicated Eclipse configuration
  • TinnR text editor with good support for communicating with R: Windows only
  • Emacs / XEmacs text editor with Emacs Speaks Statistics add-on: Cross platform (Windows, MacOS, Linux), very powerful, somewhat hard to learn

Graphical front-ends for R functions

  • Rcmdr: R Commander - A Basic-Statistics GUI for R based on Java
  • RKWard graphical user interface to R: Linux and limited Windows support

Get the article source from GitHub

R markdown - markdown - R code - all posts