Session Ready
Exercise

Graphing trend lines with geom_smooth()

In the previous exercise, you made a ggplot that displayed very sporadic lines connecting every point on your graph. When you have data this "bouncy," or even stable data with this many points, it is often better to draw trend lines over many points instead of one line between them all.

Instructions
100 XP
  • Use geom_point() and geom_smooth() to draw a trend line between the monthly Democratic.Margin in the timeline of historical polls.
  • Remember that the dataset timeseries_plot from the last exercise contains the time variable that you can use as a monthly timestamp when plotting.