Summer Institute in Statistical Genetics
Summer Institute in Statistics and Modeling of Infectious Diseases
Module 3/4: Introduction to R
Instructors: Ken Rice and Tim Thornton

This page will feature slides from our sessions, exercises for you to complete, and their solutions (all to follow). Prior to the module, please install up-to-date versions of R and RStudio on the laptop you will use during the summer institute. Both are free.

Slides and exercises

Script files are posted following each session; these will contain our R code for the exercises. To make them work on your computer, remember to modify file names and locations appropriately. Also note that many different 'correct' solutions are possible. Video/audio recordings of each session's lecture and solutions are also available.

Session 1 [Video], Introductions, reading in data. Exercises [.doc, .pdf] (R script file) [Video]

Session 2 [Video], More data summary and using functions. Exercises [.doc, .pdf] (R script file) [Video]

Session 3 [Video], Plotting functions, and formulas. Exercises [.doc, .pdf] (R script file) [Video]

Session 4 [no video yet!], Adding features to plots. Exercises [.doc, .pdf] (R script file) [Video] ... and a hypnotic old-time plotting machine with no "erase" function

Session 5 [Video], Over and over. Exercises [.doc, .pdf] (R script file) [Video]

Session 6 [Video], More loops, Control Structures, and Bootstrapping. Exercises [.doc, .pdf] (R script file) [Video]

Session 7 [Video], Fitting models. Exercises [.doc, .pdf] (R script file) [Video]

Session 8 [Video], Introduction to R packages. Exercises [.doc, .pdf] (R script file) [Video]

Evening Session [Video] -- with its Special Exercise [.doc, .pdf]. This is a more in-depth programming problem, for you to try on Thursday night. This session's slides should help with the Exercise, we'll discuss some other approaches in the final session. To help/inspire you, here are;

Session 9 [Video], Writing functions. Exercises [.docx, .pdf] (R script file) [Video]

Session 10 - updated [Video], The End! No exercises for this session


Datasets - in alphabetical order

Before trying to read data into your R session, we recommend looking at it first, in a text editor. Is the data comma- or tab-delimited? Does it have a 'header' row containing variable names?


Other resources

Some recommended books;