Material about R
Table of Contents
What is R?
R is (the) free system for data analysis. It is being actively developed by the R development core team. Numerous extentions to its core functionality are contributed in the form of packages by individuals, academic and commercial institutions from around the world.
R resources
- The R project web site This is the definitive place to look for information and downloads.
- CRAN CRAN (Comprehensive R Archive Network) is the main repository for R
software and is mirrored around the world. The link here is to the UK mirror. A
comprehensive list of mirrors can be found by choosing
CRAN
from the menu on the left-hand side of The R project page.
R documentation
All kinds of contributed documentation (in many languages) can be found in the documentation section of CRAN. Since having a lot of choice may be daunting, here are some pointers:
R Notes
Notes prepared by me for courses I teach.
- Hints about R General information about R with some useful (I hope) advice on its use. Browse this file to get a filling of what is possible, keep at hand (and add your own tips) for reference. For textbook-like introduction to R see the resources in the previous sections of this page.
R installation and administration
To install the base R system on your own computer download the installation file from CRAN and execute it.
Detailed instructions (for Windows, adapt accordingly for other OSes):
- Go to a CRAN mirror, e.g. CRAN-UK mirror.
- Under
Download and install R
, choose your operating system (Linux/Mac/Windows). - Click on
Base
. - Download the executable file (its name will be something like
R-2.11.1-win32.exe
). - Run the downloaded executable file.
- Installing R packages from CRAN
- Method 1 (executing an R command, any OS)
- In a running R session execute the command
install.packages("name_of_package")
. If R asks you for a CRAN mirror, select one from the presented list, say0-Cloud
orUK(London)
.0-Cloud
chooses the closest (to your location) R Studio server. - Method 2 (using GUI interface)
This is straightforward: in a freshly started R session choose the appropriate menu item, select the place containing the package(s) and tell R which ones to install.
Packages from standard repositories, such as CRAN are most conveniently installed directly from internet. Packages from other sources will usually reside on your computer or maybe removable media.
- Detailed instructions for Windows:
- Installing R packages from internet
- In a running R session:
- go to
Packages->Install packages
, - choose the CRAN mirror closest to you (e.g. Bristol),
- choose the required package(s) from the list, e.g.
polynom
, - Click
OK
.
- go to
- Installing R packages from local zip files
(e.g. downloaded from CRAN).
In a running R session:
- go to
Packages->Install packages from local zip files
, - navigate to the directory containing the packages,
- choose the required package(s) from the list.
- Click
OK
.
- go to
Detailed instructions for MAC (contributed by Chris Rodgers)
Go to "packages and data" heading at the top of the screen, then select "package installer".
- For standard packages select "CRAN(sources)" and select "UK(london)" (or another CRAN mirror), then "get list". Find the package you want, select it, and press install selected.
- For a downloaded package, instead of "CRAN(sources)" select "Local Source Package". Then press "install", a pop up should appear, whereby you select the package that you have downloaded (the tar archive file).
- Detailed instructions for Windows: