#1. What is the most popular fuel type?
mpg %>% count(fl) %>% arrange(desc(n))
#“r” = regular petrol → appears the most
#2. Do you think there is an effect of fuel type on how many miles a vehicle can run on average per gallon of fuel?
mpg %>% ggplot(aes(x = fl, y = hwy, fill = fl)) + geom_boxplot()
#Yes -— fuel type does affect how many miles per gallon a vehicle can run in this dataset.
#3. Do you think there is a difference in fuel economy for vehicles made in 1999 and 2008?
mpg%>% ggplot(aes(x=as.factor(year),y=hwy,fill=as.factor(year)))+ geom_boxplot()+ labs( title=“FuelEconomyin1999vs2008”, x=“Year”, y=“HighwayMPG” )
#Yes — the mpg dataset shows a noticeable difference in fuel economy between vehicles made in 1999 and 2008.
#4. What happens if you make a scatter plot of class vs drv? Do you think this plot is useful or not?
mpg %>% ggplot(aes(x = class, y = drv)) + geom_point()
#Not really,You can’t see counts clearly because points pile up and there’s no meaningful “trend” to interpret.