Day 2 — Tuesday, January 10th, 2023
Tuesday January 10th
- 1:30-2:00 Lecture: Intro to R Programming (including conditionals, control flow, etc.)
- 2:00-2:15 Activity: learnr Tutorial on Conditionals and Control Flow
- 2:15-2:45 Lecture: Data Dictionaries and Documentation
- 2:45-3:00 Activity: Q&A + Discussion
- 3:00-3:05 Break
- 3:05-3:35 Lecture: Reading in data of various formats
- 3:35-4:30 Lecture: Intro to ggplot2 (common types of figures, faceting, legends, patchwork, and saving figures)
- 4:30-4:50 Discussion: What are the ingredients to a ggplot? What makes an effective data visualization?
- 4:50-5:10 Demonstration of how to do the homework
- 5:10-5:30 Time to work on homework, chat with classmates, peruse recommended materials, engage in self-affirmation
Homework:
- Read in a dataset of your choice [we will give you some example datasets you can use] and create a few figures using ggplot2. We want to see students include titles, subtitles, captions, data sources, legends, etc.
- The figures should include one univariate figure, one bivariate figure, and one figure using facet_wrap or facet_grid
- If you’re feeling extra, have fun stylizing your plots! Go wild! Try to change up the background, fonts, etc.
Recommended materials:
- Our learnr tutorial on Conditionals, Control Flow, and Logic in R
- Smithsonian Data Management and Best Practices — Describing Your Data: Data Dictionaries
- U.S. Geological Survey, Data Dictionaries
- Skim the readr cheatsheet:
- https://raw.githubusercontent.com/rstudio/cheatsheets/main/data-import.pdf
- Keep in mind, your goal shouldn’t be to memorize everything, but rather to get a sense of what functionality is available to you, and how you could reference this cheatsheet or follow up on its contents to make use of it.
- Fundamentals of Data Visualization, Chapter 2, Visualizing data: Mapping data onto aesthetics:
- Fundamentals of Data Visualization, Chapter 17, The principle of proportional ink:
- [Video] Introduction to ggplot2 https://www.youtube.com/watch?v=UiuA5sBEcFk
- [Video] BeginneR Workshop https://www.youtube.com/watch?v=7kuPnVZcot0 [lecture starts around 20:00]
- Check the video description for the code files
- [Video] Intro to Git and GitHub https://www.youtube.com/watch?v=u4LIpYC0Yaw
Truly extra reading for those interested in advancing their conceptual understanding of ggplot2 and the possibilities in data visualization:
- A Layered Grammar of Graphics, by Hadley Wickham http://vita.had.co.nz/papers/layered-grammar.pdf
- Start to get familiar with the ggplot2 book. We recommend starting with subsection 1.2 “What is the grammar of graphics?” here: https://ggplot2-book.org/introduction.html#what-is-the-grammar-of-graphics
- The R Graph Gallery: https://r-graph-gallery.com/index.html
What you can expect from the instructional team:
- We will be reading your bios and working on sorting you into groups for the final presentation topics.