```{r} #Load Packages library(dplyr) # Import data cars <- read.csv(\"/resources
ID: 3053348 • Letter: #
Question
```{r}
#Load Packages
library(dplyr)
# Import data
cars <- read.csv("/resources/rstudio/BusStatistics/Load Data/cars.csv")
str(cars)
#histogram
ggplot(cars, aes(x = city_mpg)) +
geom_histogram() +
facet_wrap(~suv)
# density plot
ggplot(cars, aes(x = city_mpg)) +
geom_density() +
facet_wrap(~suv)
#Box plot
ggplot(cars, aes(x = city_mpg)) +
geom_boxplot() +
facet_wrap(~suv)
```
= CC Labs File Edit Code View Plots Session Build Debug Profile Tools Help ? ? ?? -. Go to file/function | B3 ? Addins CInsert1Runs- ABC Knit - 63r 64 #Load Packages 65 library(dplyr) 67 # Import data 68 carsExplanation / Answer
Your code is correct. but the only mistake is you have to load another package called ggplot2.
#Load Packages
library(dplyr)
library(ggplots) ## suppose you did not install ggplot2, then instal first and load it
# Import data
cars <- read.csv("/resources/rstudio/BusStatistics/Load Data/cars.csv")
str(cars)
#histogram
ggplot(cars, aes(x = city_mpg)) +
geom_histogram() +
facet_wrap(~suv)
# density plot
ggplot(cars, aes(x = city_mpg)) +
geom_density() +
facet_wrap(~suv)
#Box plot
ggplot(cars, aes(x = city_mpg)) +
geom_boxplot() +
facet_wrap(~suv)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.