Interactive R Worksheet: F1 Race Data

Explore Formula 1 data live in your browser

Author

Dr Gordon Wright

Published

March 24, 2026

NoteAbout this worksheet

All R code runs directly in your browser via WebR. No installation needed. Edit any code cell and press the Run button to see the results.

Part 1: Loading and exploring F1 data

WebR comes with many built-in datasets. Let us create some Formula 1 race data and explore it.

Part 2: Summary statistics

TipWhat to notice

Verstappen has the fastest mean lap time, but look at the standard deviations. Consistency matters as much as raw pace. A fast but erratic driver loses time through variation.

Part 3: Visualising lap times

Part 4: Lap-by-lap degradation

Tyre degradation means lap times typically get slower as the stint progresses. Let us visualise this.

TipTry this

Edit the code above to change set.seed(42) in Part 1 to a different number, then re-run all the cells. The entire analysis updates with new simulated data. This is reproducible research in action.

Part 5: Is Verstappen actually faster?

Summary

ImportantWhat this demonstrates
  • WebR runs R code directly in the browser with no installation
  • Students can explore data, run statistical tests, and create visualisations interactively
  • The same workflow used in RStudio works here: load data, summarise, visualise, test, interpret
  • Every code cell is editable — students can experiment freely without breaking anything