---
title: 'Lab 3: Basic Data Visualizations'
format:
  html:
    embed-resources: true
editor: source
knitr:
  opts_chunk:
    message: false
---

###### Question 1
Insert a new code chunk into your Quarto document.
In this code chunk, use the `library()` function to load the `tidyverse` package.
On the next line in this code chunk, use the the `search()` function to print out a list of packages that have been loaded, and confirm that you see `package:tidyverse` in the output.

###### Question 2

Follow [the instructions from Lab 1](setup_mac.html#instructions-1), and install the `palmerpenguins` package. **If you are using the RStudio server, you can skip this step**.

Then, insert a new code chunk into your Quarto document.
In this code chunk, use the `library()` function to load the `palmerpenguins` package.
On the next line in this code chunk, use the the `search()` function to print out a list of packages that have been loaded, and confirm that you see `package:palmerpenguins` in the output. 

###### Question 3
Modify the code snippet above to create a histogram for the `bill_length_mm` variable. 

###### Question 4
Reproduce the box plot of flipper lengths shown above by coping the code for Figure 1, and changing the `geom_histogram()` function to the `geom_boxplot()` function. 

###### Question 5
Create a figure similar to Figure 3 that includes box plots showing the distribution of the `bill_length_mm` variable for penguins from each `island`. Make sure that each island is filled in with a different color, and make sure the bill lengths are measured along the vertical axis.

###### Question 6
Use faceting to create visualization that shows a histogram of the `bill_length_mm` distribution from each `island`. In this plot, arrange the three histograms horizontally (i.e., side-by-side); in other words, the plot should appear to have 3 columns.

Then answer the following questions:

1. Which island seems to have penguins with the smallest bills?
2. Which type of visualization do you prefer for comparing distributions? Faceted histograms (like the one you just created) or stacked box plot (like in Figure 3)?

###### Question 7
Explore how using different geom's to represent the same variable can affect the quality of a data visualization by creating two new versions of Figure 6.
Your first new version should use the `shape` aesthetic to represent the `island` variable, and your second new version should use the `size` aesthetic to represent the `island` variable.
After creating these two new versions, explain which of the three (the original Figure 6 and the two new version) you prefer the most and which of the three you least prefer.

###### Question 8
Use `ggplot2` to create a plot that looks like Figure 7.

