table { border-spacing: 0.5em; } tt { color: red} td { vertical-align: top; } td:first-child { text-align: left; }

Workshops on the R System - Preparation

These notes are intended for anyone planning to attend one of the R course that I run from time to time, or wanting to test the water for possible attendance at such a course.

In preparation for the Course

Copy down the R binary, install it on your machine, start up R, and start typing!
Windows users: Click here to obtain R

Other systems, click here to look for a binary for your system (MacOS X, some flavours of Linux).

See also the document Installation of R, of R packages, and editor environments

What should I type?

> 1+1
This may suggest some other possibilities!
> nn <- 1:5
Create in the workspace an integer vector nn that holds the values 1,2,3,4,5.
NB: <- is the assignment symbol.
> nn Display (print) the contents of nn
> ls() Show the contents of the workspace. You should see "nn" listed.
> q() End (quit) the session. When asked if you want to save the workspace, make a habit of clicking on "Yes". This saves everything in the workspace into a file (called .RData, for those who really must know) in the working directory.

Before too long, there will be a need to know the path to the working directory. Start R again (the workspace, if saved on the previous exit, gets reloaded), and type:
> ls() Show the contents of the workspace.
> getwd() Get the path to the working directory
If not set or changed from the default, Windows systems are likely to use "C:/Documents and Settings/Owner/My Documents" as the working directory. Other uses for working directories (there can be as many as you want) will become apparent as the course proceeds.

There are a number of demonstrations to try.
> demo() Gives a list of demos that can be tried
> demo(graphics) Show off the graphics. Press the ENTER key to display the first graph,
and to display each successive graph.

Youtube Videos on R

Go to

Packages that should be installed

Those who bring laptops should if at all possible arrive with their laptops ready set up for use. After installing R, install also the packages animation, DAAG, DAAGxtras, latticist, latticeExtra, playwith, Rcmdr, fgui, rgl, scatterplot3d and ggplot2. Several of these packages have a number of dependencies, so that other packages should be installed along with them.

To check, e.g., that latticeExtra (and dependencies) is properly installed, start R and type, on the command line:
Other packages to which there may be reference include dichromat, fortunes, odfWeave, and rpanel.

Assuming a live internet connection, packages can be installed from the menu. You will need to select a repository. In Australia, choose an Australian repository. Alternatively, packages can be installed from the command line. For Rcmdr, a suitable command is:
  install.packages("Rcmdr", dependencies=TRUE)
The R commander has many dependencies, indirect as well as direct. Unless the internet connection is fast, this may take some time.

For playwith, and preferably also for rattle, GTk2 should be installed. NB: Gtk2 is not part of R. It is required in order to use the abilities, or some of the abilities, in certain R packages. For R-2.12 and later, download and install

Alternatively, type library(RGtk2) at the R command line (if not already installed, first install this package). If Gtk2 is not available, you will be prompted to start installation. (The installation will of course require a live internet connection.)

Installation of Packages (or even running R) from a DVD

DVDs and memory sticks will however be available at the course from which it will be possible to install, for R-2.15.2 (or a later version, once available), any packages that are lacking. Additionally, these DVDs will include an R executable that has relevant packages already installed. Once the DVD is in a computer's DVD drive, R can be run from the DVD.

What next?

Work through chapters 1 and 2, and preferably also chapter 3, of the document
Click here to get the scripts

Introductory Documents on the Web

Introductory documents that are available from the web include R for Beginners, by Emmanuel Paradis. Go to, and click on Documentation to gain access to this and other such documents.

Do you have data that you are happy to expose to wider view?

Contact the presenter with the details. Data that have been used for a published paper may be especially suitable.


Further exercises; and Weaving with R (strictly for those who want some greater challenge!)

Web site for R (CRAN = Comprehensive R Archive Network)

There are further interesting R links here.

John Maindonald's web site

email: john.maindonald AT
Last updated: Nov 11 2012.