Dr. Lee Fawcett

Reader in Applied Statistics

Newcastle University

Basic R course

If you're looking at this page, you're probably joining our stage 2 programmes directly and so haven't done any stage 1 work in R. Or perhaps you have done our stage 1 but would just like to brush up on your R skills!

This page is designed to help you feel as comfortable and prepared as possible to use R within your degree - no matter what your background.

What to do

Save the notes to your desktop. The best way to work through this webpage is to have the notes open at all times to refer to, or print them so you can make your own notes at the side.

There are tons of practice questions you can try in the Practicals booklet (see the section on "Practical work" below) and in the online NUMBAs tests (see the section on "Computer Based Assessments below). Don't feel like you have to complete them all, but the more you do the more confident you will become with using R.

Notes

You can view/download the notes here.

The notes walk through everything you need to know about R/Rstudio so that your knowledge will be at the same level as that of the other Mathematics/Statistics students entering stage 2. They will give you some background knowledge about R is so you have an understanding of the programme; they will explain how to install R on your own computer, and how to use R in general.

You should have RStudio open on your own computer or a University machine as you work carefully through the notes, typing the code in and seeing how it works for yourself. There is no point in just reading the notes to yourself - practice is key!

There are clearly indicated points where we recommend completing the associated Practical work and CBAs. These points are designed so you can practice the work gradually, however you should check that you are confident with all the Practicals again once you have finished. You'd be surprised how much easier they will be after you've gone through everything and become more familiar with R!

Datasets

This course will use a couple of datasets to illustrate some of the concepts covered. They will be discussed in more detail in the notes.

You should save them in your documents in a new folder called "HowToUseR" and set your working directory to that folder when you open R - we explain how to do this in the Practical booklet.

You can view the datasets yourself here:

  • Movies dataset: A dataset of 4847 films with 24 variables.
  • Big Bang dataset: A dataset of 50 teams with 9 variables.

Computer Based Assessments

Numbas is our system for providing computer based tests. Not only can it be used to perform formal assessment exercises, but it can be used freely as a way for you to practice your skills. Please try the Introduction first:

  • Intro: This is an introduction to Numbas.

Once you're happy with how to use the system, try our tests! To get the most out of this course, try the tests when we prompt you in the notes. As with the practical work, it would be a good idea to try them all at the end of the course too.

  • CBA1: Covers material up to section 2.5
  • CBA2a: Covers material up to section 2.7
  • CBA2b: Also covers material up to section 2.7
  • CBA3: Covers material up to section 3.2
  • CBA4: Covers the remainder of the material
Don't worry - we're not looking at your work - it's just for your own practice!

Practical work

You can view the practical work here.

This booklet contains three practicals and a revision session for you to work through. Some questions are harder than others so don't feel disheartened if you can't complete everything. Not every Mathematics/Statistics student going into Stage 2 would've been able to get 100% in them so we don't expect you to be able to!

The main objective is to make sure you understand what is going on in the majority of questions. Try them all for yourself, but if you do get stuck the solutions are provided at the end.

Online book

There is also an online book available for a more thorough description of things, available here: R book.

Contact details

  • Lee Fawcett: lee.fawcett@newcastle.ac.uk
  • Christian Lawson-Perfect: christian.perfect@newcastle.ac.uk
  • Christopher Graham: christopher.graham@newcastle.ac.uk.