Lab Homework #4.

Regarding mpg data set:

  1. What is the most popular fuel type in this data set?
table(mpg$fl)
## 
##   c   d   e   p   r 
##   1   5   8  52 168

The most popular fuel type in this data set is “r”.

  1. 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?
    Yes, there is an effect of fuel type on how many miles a vehicle can run on average per gallon of fuel.

  2. 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.). No, there is no difference in fuel economy for vehicles made in 1999 and 2008.

  3. What happens if you make a scatter plot of class vs drv? Do you think this plot is useful or not? This plot shows how many type of drive train a “type” of car have so it’s little useful.