This course is an introduction to R for the complete beginner. My goal is for students to leave the course feeling comfortable enough with R to be able to find solutions for their particular analysis needs.
Fall 2011 Syllabus
Week 1 (no meeting): Installing R
1. If you don't already have R installed somewhere, please follow these instructions to do so.
2. Please fill out this survey and bring it with you next week.
Week 2 (30 August): A first session in R
Handout: in-class exercises and homework
Week 3 (6 September): Project organization and data
Data in R class handout--detailed run-down of lecture content with links to content for in-class exercises and the homework assignment.
A Beginner's Guide to R, Chapter 2 (online or pdf) for the first in-class exercise. This UW library electronic resource is only available for UW students/faculty/staff (and if you are off-campus, you'll have to use off-campus access to get it).
A zip archive containing:
1. BGR_chap2.R: Michael's script for BGR Chapter 2 with
additional comments and exercises
2. BGR_chap2_answers.R: script with answers to the questions and
exercises posed in BGR_chap2.R
3. Deer.xls, ISIT.xls, squidGSI.txt, squidGSI2.csv,
squidGSI_filled.txt: data files for the second half of BGR
Chapter 2 (not covered in class, but available here for extra
practice).
Excel.xls, an example data file for the in-class exercise on importing data. The worksheet that goes with this data will be handed out in class, but is provided here as well.
Week 4 (13 September): Objects in R and descriptive statistics
Objects and Descriptive Statistics handout--lecture content with homework assignment.
Week 5 (20 September): Packages and subsetting data
Packages and Subsetting Handout with homework assignment
littleData.txt for in-class exercises with apply functions.
BGR Chapter 3: Accessing Variables (only available to UW students/staff).
Data files and scripts that go with BGR Chap 3.
Week 6 (27 September): Basic plotting
Basic Plotting handout with homework assignment
BGR Chapter 5: Basic Plotting ... text
Week 7 (4 October): Loops and functions
BGR Chapter 6: Loops and Functions text
Homework: Write both a loop and a function to do something interesting with your data and email the script to me by Monday, October 10.
Week 8 (11 October): More plotting
BGR Chapter 7: Graphing Tools text
Homework: Complete any homeworks you haven't already turned in.
Week 9 (18 October): Advanced plotting
I am away this week. Please finish the chapter from last week and read the handout for this week. Next week we will go over the handout in class and move on to basic stats.
Week 10 (25 October): Advanced plotting/Intro to basic stats
Some figure templates for integrating traditional and grid graphics and an example of their usage.
Homework: Read Zuur et. al 2010 for next week.
Week 11 (1 November): Some basic stats
First, we will discuss the data exploration protocol suggested by Zuur et al. 2010. You can get the Zuur et al 2010 data and R code to run their examples, if you like.
Next, we'll do a t-test together in class.
Next, we'll discuss regression and work through an example. Download the script and data.
If there is time, we will move on to permutations (randomizations). Download the script and data. I've also uploaded some more extensive reading on bootstrapping and permutations: Chapter 14 of Introduction to the Practice of Statistics, by Moore.
Week 12 (8 November): More stats and writing data to files
Please download the zip file containing everything you'll neeed for today: week12.zip
First we will walk through an example of writing out data. Use the "outdata.R" script to save you some typing.
Next we'll walk through a few more examples of stats in R: chi-squared, ANOVA, and some basic regression models. The scripts and data for these are in their respective folders in the week12.zip file.
Week 13 (15 November): Maps
Please download today's handout: HoR_maps.pdf and the zip file of today's work: week13.zip
The handout has a general overview of what we will be doing as well as links to more mapping resources. The "HoR_maps.R" file is a script walking you through several different approaches to mapping.
Week 13 (22 November): Thanksgiving -- no class
Week 15 (29 November): Final Projects
Everyone will turn in their final projects and do short oral presentations for the rest of the class. Download the final project guidelines: Final Project Requirements. I will compile the summaries to create a class resource of code that will be posted on the website. Your data will NOT be posted but rather your contact information. If someone in the class is interested in learning some code you wrote, they can contact you directly.
Final Projects -- a resource!
Download the compiled final project summaries and outcomes here (about 5.5MB). Each project has a brief summary and some have associated figures. If you see something that may be useful for your own work, contact information for project authors are included in their summaries.
R resources
Quick R: Lots of nice information, particularly for users of SAS, SPSS, and Stata. Example-driven approach.
R Cookbook: Just as the name suggests, this has contributed "recipes" for analysis. Useful, but you have to do some digging.
R Graphics library: Amazing graphing examples. Again, you have to search to find them.
R for Matlab users: Nice table of R commands side-by-side with Matlab commands (for those of you coming from a Matlab background).
Google "R cran < topic >"