Exercise 4: Making a box plot
To further investigate whether moving to the western region is a wise decision, let's make a box plot of murder rates by region, showing all points.
This exercise is part of the course
Data Science Visualization - Module 2
Exercise instructions
- Order the regions by their median murder rate by using
mutate
andreorder
. - Make a box plot of the murder rates by region.
- Show all of the points on the box plot.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
library(dplyr)
library(ggplot2)
library(dslabs)
data("murders")
murders %>% mutate(rate = total/population*100000)