URPP Tutorial

URPP Evolution
www.uzh.ch/evolution
Stefan Wyder
stefan.wyder@uzh.ch

Introduction to R

Chapters 1-5 of this tutorial are heavily based on material from the Nice R code modules introduction to R and Nice R code developed by Rich FitzJohn & Daniel Falster. The original website is available under http://nicercode.github.io/modules/
Chapter 6 is based on a Data Carpentry Workshop. with many modifications.


Topics we will cover this morning:

  1. Preliminaries: Getting your environment set up.
  2. Getting started: Starting R, using it as a calculator, and variables.
  3. Loading data: Reading in data, viewing, and subsetting.
  4. Writing functions: Avoiding errors and better describing your intent.
  5. Data types: A digression on data types
  6. ggplot2: Elegant plotting
  7. Clean Coding & Project Organization (Slideshow):
  8. Running R from Command line: Rscript

They also made a non-exhaustive list of bad habits that you should avoid and tips you should follow.

Zip file containg Data and Scripts data-and-scripts.zip

Programming Exercises

Short Reference     Repetition

Exercises
  • Movie ratings
  • Sleep in mammals
  • HairEyeColor
  • Baby names


  • All exercises with solutions