The following exercises are split into two main sections.
Section 1 of the exercises will introduce you to using R and comprises four exercises which corresponds to material covered in the first four Chapters of the Introduction to R book. We will be covering these exercises during the first two weeks of the course. It’s entirely up to you how you progress through these exercises, everyone learns R at their own pace and in their own way. You can either work your way through each section of the book and then test your understanding of the material by completing the associated exercise. Alternatively, you can start with each exercise and refer back to the appropriate material in the book. Or find another way that works for you. Whichever approach you use, make sure that you write your R code in RStudio (or your favourite script editor), annotate it liberally and save it regularly. At the end of the course you will have many hundreds of lines of code that you can refer back to at a later date when you’ve forgotten most of it! There is also an additional optional exercise (Exercise 5) which covers the book Chapter 7 - Programming in R. This exercise is entirely optional and should only be completed after you have finished the first four exercises.
Section 2 exercises will cover material introduced during the third to sixth week of the course. These exercises will help you learn how to fit linear and generalised linear models using R, how to validate these models and how to interpret these models.
The solutions and code for each of the exercises are available by following the Exrecise Solutions link in the navbar above. If you prefer to download the exercises in pdf format you can find them here.
Finally, just a word about the content of some of the early R exercises in Section 1. Initially, some of the material in these exercises might strike you as ‘pointless’, ‘trivial’ or ‘irrelevant’ and you may even ask yourself what possible use is generating sequences of numbers, concatenating elements in a vector or ordering lists of names (to name but a few). However, please stick with it, you’ll be amazed how many times you will use the skills (and code) that you have learned throughout these exercises when it comes to dealing with and analysing your own data.
Have fun!