Togaware DATA MINING
Desktop Survival Guide
by Graham Williams
Google

Basic Command Line

R is essentially a command line tool that is usually initiated by running the command R in a command line window (e.g., a gnome-terminal) on your system. When R is ready to accept your instructions it will issue the > prompt, and then wait for your input. Figure [*] shows that a user has invoked the nrow function with argument iris to find the number of rows in the iris dataset. R has responded with an answer of 150

Figure: The R Command Line is the basic interface to R.
[width=0.8]r-cli

The basic MS/Windows command line GUI provides a menu-based system to access some of the meta-functionality of R, such as to load and install packages. By default it uses a multiple document interface (MDI) so that all R windows open up in a single Rgui frame. To use a Single Document Interface (SDI) choose the appropriate option under Single or multiple windows, which you can find under the GUI preferences of the Edit menu. Then save the configuration in the default Rconsole file, and restart R.

Figure: The R interface under MS/Windows, with the default MDI display.
[width=0.8, trim=0 40 100 0, clip=true]r-ms

To interrupt a running R command simply type Ctrl-C. To exit from R use the q function:

> q()
Save workspace image? [y/n/c]: n

You are given the option to save all of the currently defined objects (the workspace image), which will automatically be reloaded next time you start R from this same location (directory). If you choose to do so R will save the workspace image to a file called .RData.

Copyright © 2004-2006 Graham.Williams@togaware.com
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware.