Exploratory Analysis II

Data visualization, part 2. Code for Quiz 8.

  1. Load the R package we will use.
library(tidyverse)
library(patchwork) #install before using
  1. Quiz Questions
  1. Pick one of your plots to save as your preview plot. Use the ggsave command at the end of the chunk of the plot that you want to preview.

Question: modify slide 51

ggplot(data = mpg) + 
   geom_point(aes(x = displ, y = hwy)) +
   facet_wrap(facets = vars(manufacturer))

Question: modify facet-ex-2

ggplot(mpg) + 
  geom_bar(aes(y = manufacturer)) + 
  facet_grid(vars(class), scales = "free_y", space = "free_y")

Question: spend_time

Download the file spend_time.csv from moodle. Or read it in directly:

read_csv(“https://stanny.moodle.school/pluginfile.php/8139/mod_resource/content/1/spend_time.csv”)

read it into spend_time


Start with spend_time


Start with spend_time


Use patchwork to display p1 on top of p2


Start with p_all


Start with p_all_no_legend


Question: Patchwork 2

use spend_time from last question patchwork slides

Start with spend_time


Start with p4


Start with spend_time


Use patchwork to display p4 and p5 on top of p6