Animated Statistics Using R (to be moved to AniWiki!)
Let's get started from here!
Obtaining R from CRAN

We can obtain either R source or binaries from CRAN (the Comprehensive R Archive Network) mirrors:

Take the mirror at UC Berkeley for example. You can see recompiled binary distributions of the base system and contributed packages in this list for different operating systems:

Windows users just have to click Windows (95 and later) and select the base directory, then download the file "R-*.*.*-win32.exe" (this is the setup program) and install it into your PC.

We may also get the source code and compile by ourselves, then just download the "R-*.*.*.tar.gz". Next I'll give a brief introduction to the compilation under Windows.

Building from Source under Windows

For detailed steps, please refer to Chapter 3 of "R Installation and Administration". The basic steps are:

  1. Download the "Windows Toolset" from; Install Rtools.exe as well as Microsoft's HTML Help Workshop, MikTeX, and InnoSetup installer. Follow the default paths if you don't know where to install, e.g. install Rtools to "C:\Rtools", and set R_HOME to "C:\R".
  2. Download R souce code, e.g. from; put it under R_HOME and open a command window (Start --> Run; cmd); extract files by tar zxvf R-2.6.0.tar.gz; now all the R source files are under "C:\R\R-2.6.0"; go to the directory "C:\R\R-2.6.0\src\gnuwin32" by cd command.
  3. Here is an important step which acutally should have been trivial, however, as we extracted source files to "C:\R\R-2.6.0" instead of "C:\R", we need to copy two directories "src" and "Tcl" under "C:\R" to "C:\R\R-2.6.0" ("override" the existing ones!). I was puzzled at this problem caused by extraction the first time I compiled R souce code under Windows... a poor & silly Windows user...
  4. Check the file "MkRules" to make sure all the paths have been correctly specified, e.g. path for InnoSetup "C:/Program Files/Inno Setup 5", etc.
  5. Now we can begin the compilation by make all recommended. Then
    make bitmapdll
    make check-all
    make manuals
    make distribution
    make check-all

    Done! Under the directory "cran" you can find the executable setup program "R-*.*.*-win32.exe".

Here is a screenshot of my compilation process:

Building from R Source under Windows
Contributed Packages

If you want to install packages from source, you need to know the usage of R CMD install first, otherwise the simple function install.packages() in R is enough. Actually I'd like to recommend you to know further knowledge about R packages, including both the building and installation. The R CMD series are helpful for us, such as:

R CMD build

R CMD check

R CMD install

As there are already many documents focusing on this topic, I'll not make redundant efforts here. Refer to "Making R Packages Under Windows" if you are interested.