Assignment Instructions

In this assignment you will recreate five graphs using ggplot2 and the mpg dataset. You will need to run the code block for each question to view the graph you will need to reproduce.

After completing the assignment, knit your document, and download both your .Rmd and knitted output. Upload your files for peer review.

For each response, include comments detailing your response and what each argument in the ggplot function does.

Question 1.
## RUN TO VIEW THE GRAPH YOU WILL NEED TO REPRODUCE 

knitr::include_graphics("images/question-1.png")

library(ggplot2)

ggplot(mpg, aes(displ,hwy)) +
  geom_point() +
  geom_smooth(se=FALSE)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Question 2.
## RUN TO VIEW THE GRAPH YOU WILL NEED TO REPRODUCE 

knitr::include_graphics("images/question-2.png")

library(ggplot2)

ggplot(data=mpg) +
  geom_smooth(aes(displ,hwy),se=FALSE)+
  geom_point(aes(displ,hwy, color=drv)) 
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Question 3.
## RUN TO VIEW THE GRAPH YOU WILL NEED TO REPRODUCE 

knitr::include_graphics("images/question-3.png")

ggplot(data=mpg) +
  geom_point(aes(displ,hwy, color=drv)) +
  geom_smooth(aes(displ,hwy, linetype=drv),se=FALSE)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Question 4.
## RUN TO VIEW THE GRAPH YOU WILL NEED TO REPRODUCE 

knitr::include_graphics("images/question-4.png")

ggplot(data=mpg) +
  geom_jitter(aes(cty,hwy, color=class))

Question 5.
## RUN TO VIEW THE GRAPH YOU WILL NEED TO REPRODUCE 

knitr::include_graphics("images/question-5.png")

ggplot(data=mpg) +
  geom_point(aes(hwy,cyl), shape=17, color="orange") +
  facet_wrap(~class, nrow=3)