Question: In this exercise that follows, we consider a dataset mpg consisting of fuel economy data from 1999 and 2008 for 38 popular models of car.

In this exercise that follows, we consider a dataset mpg consisting of fuel economy data from 1999 and 2008 for 38 popular models of car.

1. Execute the bloc of code and explain the obtained result.

install.packages("ggplot2")

library(ggplot2)

bloc 1: head(mpg)

bloc 2: str(mpg)

bloc 3: summary(mpg)

bloc 4: p <- ggplot(mpg, aes(x = displ, y = hwy))

p <- p + geom_point() # add a plot layer with points

print(p)

bloc 5: p <- ggplot(mpg, aes(x = displ, y = hwy))

p <- p + geom_point(aes(colour = class))

print(p) by using R code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!