Boxplots
Now we are going to make boxplots. Boxplots are useful when we want a summary of several variables or several strata of the same variables. Making too many histograms can become too cumbersome.
This exercise is part of the course
Data Science R Basics
Exercise instructions
In one line of code:
- Stratify the state populations by region.
- Generate boxplots for the strata.
Note that you can achieve this using this population~region
inside boxplot
to generate the strata and specify the dataset with the data
argument.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create a boxplot of state populations by region for the murders dataset