Skip to main content

Overview


This course helps you get started with data handling, graphs and statistical analysis in R. There are six sections. It’s designed to help you become independent, so we spend some time looking at how to get help when things don’t work. There are also plenty of exercises and pieces of code to try out along the way. Be an active learner: try everything out, and when you don’t understand something, think up a hypothesis or two about what might be happening. Or you can always move on and see if it becomes clear later.
After following this course, you should be able to:

  • import data from a spreadsheet such as Excel
  • manipulate data, such as transforming variables and taking subsets
  • export tables as text files
  • plot basic graphs of your data and copy them into a document
  • calculate summary statistics
  • use general linear models
  • find R functions to do anything else you require, and know how to get help

Blue highlighted text like this contain exercises and demonstrations to try. Please type everything in Courier font into R as you read. Start now: open the R programme (e.g. via Start > Programs > Statistics > R, or a shortcut icon if you can see one). A window should appear with some introductory text in blue. Underneath that there’ll be a prompt (>) in red. Type in the following two lines, pressing Enter after each one – and see what happens...

plot(1:10, col="blue")
abline(h=4)

Now you should have two windows within your R console: the GUI window and a new graphics window.

Take care when typing! It can be difficult to distinguish the number 1 from a lower-case letter l. But you probably got them right in the exercise we’ve just done – did you?

The central point of reference for R is the web site http://www.r-project.org/. There is then a “Comprehensive R Archive Network” (CRAN) of servers around the world, which are identical, authentic sources of R (R Development Core Team 2007) and the contributed packages for R. For downloading any of these, you will be asked to select your local server. If you’re installing R on your own computer, the main set-up programme for Windows will be called something like R-3.0.2-win.exe – click on it, choose “Run” and follow the instructions.

Green highlighted text like this contains additional information that may help your understanding. This can be ignored to start with if you’re suffering from information overload.