1. Learn
  2. /
  3. Courses
  4. /
  5. HarvardX Data Science Module 4 - Inference and Modeling

Exercise

Exercise 5- Plotting Prediction Results

Make a barplot based on the result from the previous exercise.

Instructions

100 XP
  • Reorder the states in order of the proportion of hits.
  • Using ggplot, set the aesthetic with state as the x-variable and proportion of hits as the y-variable.
  • Use geom_bar to indicate that we want to plot a barplot. Specifcy stat = "identity" to indicate that the height of the bar should match the value.
  • Use coord_flip to flip the axes so the states are displayed from top to bottom and proportions are displayed from left to right.