Question #1: What is the most popular fuel type in this data
set?
ggplot(mpg) + geom_bar(aes(x=fl, fill = fl))

Answer: The most popular fuel type is “r” (regular petrol)
Question #2: Regarding the fuel type variable, the value “d”
represents diesel, “p” represents premium (petrol) and “r” represents
regular (petrol). Do you think there is an effect of fuel type on how
many miles a vehicle can run on average per gallon of fuel?
ggplot(data = mpg) + geom_point(mapping = aes(x = fl, y = hwy), position = "jitter")

Answer: According to the figure, the fuel type seems to have some
association with the miles per gallon a car can drive. In which, “d”
diesel and
Question #3: Do you think there is a difference in fuel economy for
vehicles made in 1999 and 2008? (When plotting with “year” variable, use
as.factor(year) to convert it to categorical variables. This will be
explained in future classes.)
Question #4: What happens if you make a scatter plot of class vs
drv? Do you think this plot is useful or not?