Here are the instructions on how to install the statistics package R. I'll show you how to install in Linux, Mac and Windows. The procedures below have been tested in Ubuntu 12.04, Mac OS Mountain Lion and Windows 7. It should not give any problems if you have older versions.
Other Debian-based Linux distributions, e.g. Linux Mint, have the same procedures as Ubuntu. Installation in Fedora and OpenSUSE can be slightly different, but if you use such a distribution you probably have the knowledge to find out.
In some appendices, I'll give some information for those who are adventurous. The R Journal mentioned below is a free, refereed journal.
If you don't have Ubuntu but are considering it, please have a look at the distribution's home page and this excellent guide. Ubuntu uses the new desktop environment Unity. If you prefer KDE or XFCE you can instead use Kubuntu or Xubuntu, respectively. (You can even have all of them in the same partition.)
Some people don't like Unity, some even more so the new Gnome 3. If so, you can try Linux Mint with either MATE or Cinnamon.
Linux is all about choice; you may even prefer to call it GNU/Linux.
If you are in a hurry, skip the rest and just use this in Ubuntu:
sudo apt-get install r-base
For most Linux distributions, you don't need to fetch R from CRAN because it is included in the repositories. Only if you want the very newest version you should consider using CRAN, and this will not be needed in this course. There are graphical ways of installing R. For instance, in Ubuntu you can use Ubuntu Software Center. But the simplest way is to use the command line.
In Ubuntu and other Debian-based distributions, the command is
sudo apt-get install r-base
(In Fedora, use yum install R)
You start R with the command R and leave R with q(). (You would probably never guess this pristine version! Today you can use quit() as well.)
If you miss a GUI (Graphical User Interface) you may consider using R Commander, see Packages in R below.
Some people (like me) still use the text editor Emacs. If so you might consider using "Emacs Speaks Statistics," in Ubuntu
sudo apt-get install ess
In the file .emacs there must then be the line
(require 'ess-site)
On CRAN, more precisely on the download page, click R-2.15.1.pkg.
When the automatic downloading has finished, click the Downloads icon and then the package.
In the installer window, click Continue. Click Agree in the License window, Then Install and your password.
In Applications you now have two icons, R for 32 bits and R64 for 64 bits. You can safely remove the 32-bit version by pulling the R icon to Trash. (You can run the 32-bit version, but it will be ca. 20% slower.)
You can run R by clicking the R64 icon, but you can also give the command R in a Terminal window.
On CRAN, more precisely on the download page, click Download R 2.15.1 for Windows.
Click Run in the small window and then Yes in the User Account Control.
Select English as language. (Even if it is not your mother tongue I recommend this.)
Use the Setup Wizard and follow the defaults.
Select 32-bit or 64-bit files according to your computer. (You can run the 32-bit version on a 64-bit computer, but it will be ca. 25% slower.)
If you have choosen the proposed defaults, you now have an icon for R on your desktop.
R has 4023 packages at the moment of writing! Some are installed by default, which you can check within R with the command search(). More come with the installation, which you can check with the command library().
As an example, we shall install the package mvtnorm, useful for work with the multivariate Normal distribution (and the multivariate t distribution. In Ubuntu, you can simply use the command
sudo apt-get install r-cran-mvtnorm
In other systems you can do the following:
Within R, install the package with the command
install.packages("mvtnorm")
You are asked about repository, "Denmark" being the obvious choice.
Other packages can be installed from CRAN in a similar way (some can be installed with apt-get in Ubuntu), but if the above methods fails, try to download the package and install it from the command line (outside R) with the command R CMD INSTALL.
R is very much based on using the command line. Some people (but probably few following this course) are somewhat scared about this. If you are more comfortable by clicking icons and pulling down menus, you could consider installing R Commander. (I will not recommend it, however, for me it is vastly superior to use the command line!) Within R (also in Ubuntu with sudo) use the command
install.packages("Rcmdr")
It is not necessary for this course to have the newest version of R, but if you like to, in Windows regularly check for new versions in CRAN.
In Linux you can have automatic updating by enlarging your package repository. In Ubuntu, add the following line in /etc/apt/sources.list:
deb http://cran.r-project.org/bin/linux/ubuntu precise/
The paranoid can install the security checker:
gpg --keyserver subkeys.pgp.net --recv-key E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -
Then run
sudo apt-get update && sudo apt-get upgrade