library(tidyverse)
library(palmerpenguins)
AE 02: Visualizing penguins
Application exercise
For all analyses, we’ll use the tidyverse and palmerpenguins packages.
The dataset we will visualize is called penguins
. Let’s glimpse()
at it.
# add code here
Visualizing penguin weights - Demo
Single variable
Create visualizations of the distribution of weight
s of penguins.
- Make a histogram. Set an appropriate binwidth.
# add code here
- Make a boxplot.
# add code here
- Based on these, determine if each of the following statements about the shape of the distribution is true or false.
- The distribution of penguin weights in this sample is left skewed. FALSE
- The distribution of penguin weights in this sample is unimodal. TRUE
Two variables
Create visualizations of the distribution of weight
s of penguins by species
.
- Make a single histogram. Set an appropriate binwidth.
# add code here
- Use multiple histograms via faceting, one for each species. Set an appropriate binwidth, add color as you see fit, and turn off legends if not needed.
# add code here
- Use side-by-side box plots. Add color as you see fit and turn off legends if not needed.
# add code here
- Use density plots. Add color as you see fit.
# add code here
- Use violin plots. Add color as you see fit and turn off legends if not needed.
# add code here
- Make a jittered scatter plot. Add color as you see fit and turn off legends if not needed.
# add code here
- Use beeswarm plots. Add color as you see fit and turn off legends if not needed.
# add code here
- Use multiple geoms on a single plot. Be deliberate about the order of plotting. Change the theme and the color scale of the plot. Finally, add informative labels.
# add code here
Multiple variables
- Facet the plot you created in the previous exercise by
island
. Adjust labels accordingly.
# add code here
Before you continue, let’s turn off all warnings the code chunks generate and resize all figures. We’ll do this by editing the YAML.
Visualizing other variables - Your turn!
- Pick a single categorical variable from the data set and make a bar plot of its distribution.
# add code here
- Pick two categorical variables and make a visualization to visualize the relationship between the two variables. Along with your code and output, provide an interpretation of the visualization.
# add code here
Interpretation goes here…
- Make another plot that uses at least three variables. At least one should be numeric and at least one categorical. In 1-2 sentences, describe what the plot shows about the relationships between the variables you plotted. Don’t forget to label your code chunk.
# add code here
Interpretation goes here…