Interactive lessons

Each class session has an interactive lesson that you will work through after doing the readings and watching the lecture. These lessons are a central part of the class—they will teach you how to use {ggplot2} and other packages in the tidyverse to create beautiful and truthful visualizations with R.

Interactive code sections look like this. Make changes in the text box and click on the green “Run Code” button to see the results. Sometimes there will be a tab with a hint or solution.

Your turn

Modify the code here to show the relationship between health and wealth for 2002 instead of 2007.

Hint: You’ll want to change something in the code that creates gapminder_filtered. The text in the subtitle won’t change automatically, so you’ll want to edit that too.

If you’re curious how this works, each interactive code section uses the amazing {quarto-webr} package to run R directly in your browser.