Check in

Class announcements

Lab 01 returned

Questions about Lab 03 or HW 01?

Arranging plots using patchwork

You may have a series of plots you want to share as part of your analysis (e.g. plots in exploratory data analysis, plots to check model conditions), but you don’t want the reader to need to scroll through pages of plots. The patchwork package in R makes it easy to combine multiple plots and neatly organize them in a grid.

# if you need to install the package
#install.packages("patchwork") 
library(tidyverse)
library(patchwork)
mtcars <- mtcars %>%
  mutate(am = factor(am))
p1 <- ggplot(data = mtcars, aes(x = mpg)) +
  geom_histogram(fill = "steelblue") + 
  labs(x = "Miles per gallon", 
       title = "Distribution of car mileage")

p2 <- ggplot(data = mtcars, aes(x = am)) +
  geom_bar(fill = "steelblue") + 
  labs(x = "Transmission type", 
       title = "Car transmissions", 
       subtitle = "0: automatic, 1: manual")

p3 <- ggplot(data = mtcars, aes(x = am, y = mpg)) + 
  geom_boxplot(fill = "steelblue") + 
  labs(x = "Transmission type", 
       y = "Miles per gallon", 
       title = "Mileage vs. Transmission")
p1 + p2

p1 / p2

p3 + (p1 / p2)

Questions from videos about conditions or prediction

AE 06: Price of textbooks

Clone the ae-06 repo and open a new project in RStudio. Be sure to push your work periodically as you complete the AE.