rhao22
06.10.2015
This application calculates the average miles per gallon of cars depending on:
Here is a calculation example frc cars with:
subset1 <- mtcars[which(mtcars$cyl==4),]
subset2 <- subset1[which(subset1$gear==4),]
subset3 <- subset2[which(subset2$am==1),]
MeanMPG <- mean(subset3$mpg)
MeanMPG
[1] 28.03333
A graph is shown displaying the miles per gallon depending on the weight of the cars. With the same parameter as in the previous slide:
This application gives an idea of the miles per gallon average of cars having a specific number of cylinders, forward gears and being automatic or manual.