Module 3: Introduction to R
Instructors: Ken Rice and Ting Ye
This page will feature slides from our sessions, recordings of the various sessions, exercises for you to complete, and their solutions (all to follow).
Prior to the module, please install uptodate versions of R and RStudio on the computer 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. All times/dates are Pacfic, i.e. Seattle time.
The module has 10 sessions, each of 80 minutes. The basic format for a session is:
 45 minutes of lecture material. These will be recorded and made available as soon as possible. Recordings from 2020 are also available, if you want to watch in advance.
 25 minutes of exercises for you to try, with smallgroup "breakout" Zoom sessions available, attended by other class participants, and Teaching Assistants. These are not recorded.
 10 minute discussion of exercises, where the instructors will present possible solutions and answer questions. These will be recorded.
Please join the module's Slack channel, where you can ask questions and see realtime updates from the instructors and TAs.
Zoom room for all sessions.
Wednesday, July 7th 
Time 
Topic 
Lecture 
Exercises/Discussion 
11:30am12:50pm 
1. Introductions, reading in data 
Slides [.pdf], Code [.R], video (2020) ZoomRec, starts 0:01:14

Exercises [.docx, .pdf] Key: [.R] ZoomRec, starts 1:13:03 
1:10pm2:30pm 
2. More data summary and using functions 
Slides [.pdf], Code [.R], video (2020) ZoomRec, starts 1:22:37 
Exercises [.docx, .pdf], Key: [.R] ZoomRec, starts 2:27:42 

Thursday, July 8th 
Time 
Topic 
Lecture 
Exercises/Discussion 
8:00am9:20am 
3. Plotting functions, and formulas 
Slides [.pdf], Code [.R], video (2020) ZoomRec 
Exercises [.docx, .pdf], Key: [.R], ZoomRec 
9:40am11am 
4. Adding features to plots 
Slides [.pdf], Code [.R], video (2020) ZoomRec 
Exercises [.docx, .pdf], Key: [.R] ZoomRec 
11:30am12:50pm 
5. Over and over (i.e. loops) 
Slides [.pdf], Code [.R], video (2020), ZoomRec 
Exercises [.docx, .pdf], Key: [.R] ZoomRec 
1:10pm2:30pm 
6. More loops, Control Structures, and Bootstrapping 
Slides [.pdf], Code [.R], video (2020), ZoomRec 
Exercises [.docx, .pdf] Key: [.R] ZoomRec 

Friday, July 9th 
Time 
Topic 
Lecture 
Exercises/Discussion 
8:00am9:20am 
7. Fitting models 
Slides [.pdf], Code [.R], video (2020), Zoomrec 
Exercises [.docx, .pdf] Key: [.R], Zoomrec 
9:40am11am 
8. Introduction to R packages 
Slides [.pdf], Code [.R], video1 (2020) video2 (2020), Zoomrec 
Exercises [.docx, .pdf] Key: [.R], Zoomrec 
11:30am12:50pm 
9. Writing your own functions 
Slides [.pdf], Code [.R], video (2020), Zoomrec 
Exercises [.docx, .pdf] Key: [.R], Zoomrec 
1:10pm2:30pm 
10. The End! 
Slides [.pdf] , resources below, Zoomrecwhole session 
Some special material for Session 10:
Comments forms and attendance certificates are available here  requires SISG account.
For easier searching, here are all the slides in one document (PDF).
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 tabdelimited? Does it have a 'header' row containing variable names?
Other resources
