Question
Complete this assignment in an R Markdown document. Well use the mpg dataset that comes with ggplot2 package. Note: Be sure that you have installed
Complete this assignment in an R Markdown document. Well use the mpg dataset that comes with ggplot2 package. Note: Be sure that you have installed and attached the ggplot2 pacakage. This is easily done by installing and attaching the tidyverse package. Call this dataset mpg and import into your environment with the code chunk below:
mpg = ggplot2::mpg
Show all R code in code chunks.
Q1 How many rows and columns are in this dataset?
Q2 Plot city gas mileage (cty variable) versus highway gas mileage(hwy). Use geom_point. Describe the relationship between these two variables.
Q3 Plot city gas mileage (cty variable) versus highway gas mileage(hwy) and facet on the class variable. Use geom_point. Comment on the relationships in these plots.
Q4 Plot city gas mileage (cty variable) versus the cylinders (cyl) variable. Use geom_point. Comment on the appropriateness of the choice of using a scatterplot for this plot.
Q5 Use knitr::kable to create a table of the first 10 rows AND first 5 columns of the dataset.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started