A Little Book of R For Bioinformatics
Release 0.1
Avril Coghlan
June 10, 2011
CONTENTS
i
ii
A Little Book of R For Bioinformatics, Release 0.1
By Avril Coghlan, University College Cork, Cork, Ireland. Email: a.coghlan@ucc.ie
This is a simple introduction to bioinformatics, with a focus on genome analysis, using the R statistics software.
To encourage research into neglected tropical diseases such as leprosy, Chagas disease, trachoma, schistosomiasis
etc., most of the examples in this booklet are for analysis of the genomes of the organisms that cause these diseases.
There is a pdf version of this booklet available at http://media.readthedocs.org/pdf/a-little-book-of-r-for-
bioinformatics/latest/a-little-book-of-r-for-bioinformatics.pdf.
Contents:
CONTENTS
1
A Little Book of R For Bioinformatics, Release 0.1
2
CONTENTS
CHAPTER
ONE
HOW TO INSTALL R
1.1 Introduction to R
This little booklet has some information on how to use R for bioinformatics.
R (www.r-project.org) is a commonly used free Statistics software. R allows you to carry out statistical analyses
in an interactive mode, as well as allowing simple programming.
1.2 How to check if R is installed on a Windows PC
To use R, you first need to install the R program on your computer.
These instructions are for installing R on a Windows PC.
Before you install R on your computer, the first thing to do is to check whether R is already installed on your
computer (for example, by a previous user). There are two ways you can do this:
1. Check if there is an “R” icon on the desktop of the computer that you are using. If so, double-click on the
“R” icon to start R. If you cannot find an “R” icon, try step 2 instead.
2. Click on the “Start” menu at the bottom left of your Windows desktop, and then move your mouse over
“All Programs” in the menu that pops up. See if “R” appears in the list of programs that pops up. If it does,
it means that R is already installed on your computer, and you can start R by selecting “R” (or R X.X.X,
where X.X.X gives the version of R, eg. R 2.10.0) from the list.
If either (1) or (2) above does succeed in starting R, it means that R is already installed on the computer that you
are using. (If neither succeeds, R is not installed yet). If there is an old version of R installed on the Windows PC
that you are using, it is worth installing the latest version of R, to make sure that you have all the latest R functions
available to you to use.
1.3 Finding out what is the latest version of R
To find out what is the latest version of R, you can look at the CRAN (Comprehensive R Network) website,
http://cran.r-project.org/.
Beside “The latest release” (about half way down the page), it will say something like “R-X.X.X.tar.gz” (eg.
“R-2.12.1.tar.gz”). This means that the latest release of R is X.X.X (for example, 2.12.1).
New releases of R are made very regularly (approximately once a month), as R is actively being improved all the
time. It is worthwhile installing new versions of R regularly, to make sure that you have a recent version of R (to
ensure compatibility with all the latest versions of the R packages that you have downloaded).
3
A Little Book of R For Bioinformatics, Release 0.1
1.4 Installing R on a Windows PC
To install R on your Windows computer, follow these steps:
1. Go to http://ftp.heanet.ie/mirrors/cran.r-project.org.
2. Under “Download and Install R”, click on the “Windows” link.
3. Under “Subdirectories”, click on the “base” link.
4. On the next page, you should see a link saying something like “Download R 2.10.1 for Windows” (or R
X.X.X, where X.X.X gives the version of R, eg. R 2.11.1). Click on this link.
5. You may be asked if you want to save or run a file “R-2.10.1-win32.exe”. Choose “Save” and save the file
on the Desktop. Then double-click on the icon for the file to run it.
6. You will be asked what language to install it in - choose English.
7. The R Setup Wizard will appear in a window. Click “Next” at the bottom of the R Setup wizard window.
8. The next page says “Information” at the top. Click “Next” again.
9. The next page says “Information” at the top. Click “Next” again.
10. The next page says “Select Destination Location” at the top. By default, it will suggest to install R in
“C:\Program Files” on your computer.
11. Click “Next” at the bottom of the R Setup wizard window.
12. The next page says “Select components” at the top. Click “Next” again.
13. The next page says “Startup options” at the top. Click “Next” again.
14. The next page says “Select start menu folder” at the top. Click “Next” again.
15. The next page says “Select additional tasks” at the top. Click “Next” again.
16. R should now be installed. This will take about a minute. When R has finished, you will see “Completing
the R for Windows Setup Wizard” appear. Click “Finish”.
17. To start R, you can either follow step 18, or 19:
18. Check if there is an “R” icon on the desktop of the computer that you are using. If so, double-click on the
“R” icon to start R. If you cannot find an “R” icon, try step 19 instead.
19. Click on the “Start” button at the bottom left of your computer screen, and then choose “All programs”, and
start R by selecting “R” (or R X.X.X, where X.X.X gives the version of R, eg. R 2.10.0) from the menu of
programs.
20. The R console (a rectangle) should pop up:
4
Chapter 1. How to install R