Week 2: Interactive R Exercises

Quantitative Methods · Introduction to R

R runs in your browser: nothing to install, no working directory to set. Work through the blocks in order, one block at a time, during the lecture. The slides tell you when to open the next block.

Block Reading Min
Block 1: Arithmetic and objects Imai §1.3.1–1.3.2 12
Block 2: Vectors and indexing Imai §1.3.3 18
Block 3: Functions Imai §1.3.4 17
Block 4: Data frames Imai §1.3.5 15
Block 5: Missing values and a first plot Imai §1.3.5 13
Block 6: Break it on purpose debugging 8
NoteTips
  • The first page load takes a few seconds while R starts. Keep the tab open.
  • For each task: read the code, predict, answer the question; the runnable cell then opens. Use Hint and Solution only after you tried.
  • Your code is not saved when you close the tab. Copy what you want to keep into RStudio.
  • Real analyses (labs, final project) use RStudio; this page is for the small exercises.

Start with Block 1 →