Desktop Survival Guide
by Graham Williams

Installing GTK, R, and Rattle

Rattle is distributed as an R package and is available from, the Comprehensive R Archive Network. The latest version is also available as an R package from http://rattle.togaware.comTogaware. The source code is freely available from Code, where it is also possible to join the Rattle users mailing list.

The first step in installing Rattle is to install the GTK+ libraries, which provide the Gnome user interface. We need to install the correct package for our operating system. This installation is independent of the installation of R itself and is emphasised as a preliminary step that is often overlooked when installing Rattle.2.1

If you are new to R there are then just a few steps to get up and running with Rattle. If you are running on a Macintosh, be sure to run R from inside X11 (off the XCode CD) using the X11 shell to start R, as native Mac GTK+ is not fully supported. (Also, you need to use gcc 4.0.3, rather than the Mac's 4.0.1.) Be sure to install the glade libraries before installing RGtk2, since RGtk2 will ignore libraries that it can't find at the time of installation (e.g., you may find that newGladeXML is undefined).

  1. Install the GTK+ libraries
    For GNU/Linux these libraries will already be installed if you are running Gnome, but make sure you also have libglade installed. If you are not running Gnome you may need to install the GTK+ libraries in your distribution. For example, with the excellent http://www.debian.orgDebian GNU/Linux distribution you can simply install the Glade package:

    Debian: wajig install libglade2-0

    For MS/Windows, install the latest version of the Glade package from the for Windows website. Download the self-installing package (e.g., gtk-win32-devel-2.8.10-rc1.exe) and open it to install the libraries:

    MS/Windows: run gtk-win32-devel-2.8.10-rc1.exe

    An alternative that seems to work quite well is to get everything installed by running an R script that also installs the rggobi package. You can start up R and then type the command:


    This installs the GTK libraries for windows and the rggobi package for R. (You need R installed already of course - see the next step.) For Mac/OSX, make sure Apple X11 is installed on your machine as GTK (and anything built with it) is not native to OSX. Using darwinports you can install the packages:

    Mac/OSX: $ sudo port install gtk2
    Mac/OSX: $ sudo port install libglade2

    For All installations, after installing libglade or any of the other libraries, be sure to restart the R console, if you have one running. This will ensure R can find the newly installed libraries.

  2. Install R
    For GNU/Linux R is packaged for many distributions. For example, on http://www.debian.orgDebian GNU/Linux install the packages with:

    Debian: $ wajig install r-recommended

    For MS/Windows the binary distribution can be obtained from the http://www.r-project.orgR Project website. Download the self-installing package and open it.

    MS/Windows: run R-2.4.0-win32.exe

    For Mac/OSX you can also download the package from CRAN and install it.
    For All installations, to check if you have R installed, start up a Terminal and enter the command R (that's just the capital letter R). If the response is that the command is not found, then you probably need to install the R application!

    $ R
    R version 2.4.1 (2006-12-18)
    Copyright (C) 2006 The R Foundation for Statistical Computing
    ISBN 3-900051-07-0
    R is free software and comes with ABSOLUTELY NO WARRANTY.
    You are welcome to redistribute it under certain conditions.
    Type 'license()' or 'licence()' for distribution details.
      Natural language support but running in an English locale
    R is a collaborative project with many contributors.
    Type 'contributors()' for more information and
    'citation()' on how to cite R or R packages in publications.
    Type 'demo()' for some demos, 'help()' for on-line help, or
    'help.start()' for an HTML browser interface to help.
    Type 'q()' to quit R.

  3. Install RGtk2
    This package is available on CRAN and from the web site. From R, use:

    R: > install.packages("RGtk2")

    Or to install the most recent release:

    R: > install.packages("RGtk2",repos="")

    On GNU/Linux you can generally just install the appropriate package. On Debian this is done with:

    Debain: $ wajig install r-cran-gtk2

    On Mac/OSX run the command line install, after downloading the source package from

    Mac/OSX: $ R CMD INSTALL RGtk2_2.8.6.tar.gz

    You may not be able to compile RGtk2 via the R GUI on Mac/OSX as the GTK libraries can not be found when gcc is called. Once installed though, R will detect the package; just don't try to load it within the GUI as GTK is not a native OSX application and it will break.

    For All installations, to test whether you have RGtk2 installed enter the R command

    R: > library(RGtk2)

  4. Install R Packages
    The following additional R packages are used by Rattle, and without them some functionality will be missing. Rattle will gracefully handle them being missing so there is no need to install them all, or to install them all at once. If you perform an action where Rattle indicates a package is missing, you can then install the package. Type ?install.packages at the R prompt for further help on installing packages.

    R: > install.packages(c("ada", "arules", "bitops", "cba", 
           "combinat", "doBy", "ellipse", "fBasics", "fpc", 
           "gdata", "gplots", "gtools", "Hmisc", "kernlab", 
           "MASS", "network", "randomForest", "rggobi", "RODBC", 
           "ROCR", "rpart", "XML"))

  5. Install Rattle
    From within R you can install Rattle directly from CRAN with:

    R: > install.packages("rattle")

    An alternative is to install the most recent release from Togaware:

    R: > install.packages("rattle", 

    You can also download the rattle package directly from Download either the .tar.gz file for GNU/Linux and Mac/OSX, or the .zip file for MS/Windows, and then install with, for example:

    R: > install.packages("", repos=NULL)

    Alternatively, for example on Mac/OSX, you can do the following:

    Mac: R CMD INSTALL rattle_2.2.10.tar.gz

  6. Start Rattle
    Within a terminal on GNU/Linux, or from an XTerminal in Mac/OSX, or by running Rgui.exe on MS/Windows (we call all these, generically, the R Console), you can load the rattle package into R's library:

    R: > library(rattle)

    This loads the Rattle functionality (which is also available without running the Rattle GUI). To start the Rattle GUI simply run the command:

    R: > rattle()

The main Rattle window will be displayed. You will see a welcoming message and a hint about using Rattle.


Copyright © 2004-2006 [email protected]
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware.