Load Libraries

library(rmarkdown)
library(tidyverse)

ggplot with Cars Data

Special thanks to Wickham & Grolemund’s R for Data Science from which this example is adapted

ggplot(data = mpg, mapping = aes(x = displ, y = hwy, color= drv)) + 
     geom_smooth(mapping = aes(linetype = drv), method = 'loess') +
     geom_point()