Lecture Materials for Week 3
September 8, 2025
Data collection for next lecture
- During today’s class period, please do the following: Proceed to the weighing station set up in the classrom. From the bag next to the scale, choose 5 pieces of candy. Weigh each piece of candy using the scale. On a slip of paper, record the label number for each of your selections as well as the corresponding weight of the piece of candy in grams (round to the nearest tenth). Return all 5 selections of candy back to the bag. After your turn at the weighing station — click this link to proceed to a qualtrics form to input your data.
Digging into ggplot2
Slides for lecture
Resources
- Click here for more information about using the WDI package to access World Bank data.
- Do you want to learn to write beautiful and optimally readable (for humans and computers) code? Check out this chapter from R for Data Science.
- In this slide deck, the truly magical webR is used. For those interested, webR is an open-source R interpreter compiled for WebAssembly that allows R to be run in a browser. It’s not a replacement for R and RStudio — but it does create a wonderful method for practicing simple tasks during our class periods.
Practice wrangling and plotting
If we have time in class, we can work on this activity together, otherwise you can complete it on your own.
Resources
The Epidemiologist R Handbook was mentioned in the slide deck — this is a helpful online handbook for learning to use R.
If you need help while completing this activity, check out these awesome Posit Cheatsheets:
dplyr cheatsheet for data wrangling
tidyr cheatsheet for tidying data (including pivoting)
ggplot2 cheatsheet for graphing