Ecol 596W – Programming for Data Analysis in R

Spring semester 2016

Course outline and timeline

*Timeline subject to change depending on progress rates

Tutorial 1: R Primer (Week 1, Jan 15 – Week 2, Jan 22)

  • This tutorial is meant to get you on your feet in R.
  • Part 1: How easy are ANOVAs, regressions, and plots?
  • Part 2: Introducing R Studio and basic R functionality.
  • Part 3: Objects, object classes, text
  • Part 4: Vectors and vector indexing
  • Part 5: Built-in functions, and R Help
  • Part 6: Matrices – creating, indexing, and manipulating
  • Part 7: Data frames – R’s most common data format
  • Part 8: Importing data as data frames
  • Part 9: Getting info from bigger data frames
  • Part 10: Packages
  • Part 11: Basic troubleshooting

Tutorial 2: Indexing—pointing at things (Week 3, Jan 29 – Week 6, Feb 19)

  • Part 1: Indexing in vectors
  • Part 2: Indexing with logicals and objects
  • Part 3: Indexing in matrices
  • Part 4: Indexing in data frames
  • Part 5: Indexing in lists
  • Part 6: Advanced indexing – techniques, nuances, and nuisances

Tutorial 3: For Loops—iteration of analyses (Week 7, Feb 26 – Week 9, Mar 11)

  • Part 1: Basic principles of iterations using for loops
  • Part 2: Simple examples
  • Part 3: Growing vectors; multiple references with ‘i’
  • Part 4: Nested for loops
  • Part 5: Flow control with if, else, else if, and next

Tutorial 4: Custom functions—the bread and butter of effective R use (Week 11, Mar 25 – Week 13, Apr 8)

  • Part 1: Custom functions basic structure
  • Part 2: Default arguments and flow control
  • Part 3: Return()ing objects; custom errors and warnings; source()ing your own library
  • Part 4: Devloping from blank screen to complete function
  • Part 5: Dynamic graph titles that track function options
  • Part 6: Nested custom functions

Tutorial 5: Apply functions—fast iteration (Week 14, Apr 15 – Week 15, Apr 22)

  • Part 1: sapply(), iterate and simplify
  • Part 2: apply(), iterate across rows or columns
  • Part 3: Using apply() to guide functions across analysis templates
  • Part 4: tapply(), iterate across groups by categorical variables
  • Part 5: aggregate(), iterate across groups and return a data frame of results
  • Part 6: lapply(), iterate across lists or vectors and return a list 

Tutorial 6: Plotting—base R and the ggplot2 package (Week 16, Apr 29)

  • Part 1: Plotting on maps by latitude and longitude
  • Part 2: ggplot2’s “grammar of graphics”; data formatting with reshape2; basic plots and visual effects
  • Part 3: Multi-panel graphs
  • Part 4: Heat maps
  • Part 5: ggplot2 in custom functions

Final projects due: May 6

Leave a Reply