mtcars Analysis -- Mean Plots

Sameer Mathur

Rename Transmissions (Automatic and Manual) and Cylinders (4-Cyl, 6-Cyl and 8-Cyl)

# create a factor for Transmission Type
mtcars$am.f <- factor(mtcars$am, 
                      levels=c(0,1), 
                      labels=c("Automatic","Manual"))

# create a factor for number of cylinders
mtcars$cyl.f <- factor(mtcars$cyl,
                       levels=c(4,6,8),
                       labels=c("4-Cyl","6-Cyl","8-Cyl"))

Mean plots of transmission

library(gplots)
# Plot the mean of teeth length by dose groups
plotmeans(mtcars$mpg ~ mtcars$am.f, data = mtcars, frame = FALSE)

Mean plots of transmission

plot of chunk unnamed-chunk-3

Mean plots of Cylinders

library(gplots)
# Plot the mean of teeth length by dose groups
plotmeans(mtcars$mpg ~ mtcars$cyl.f, data = mtcars, frame = FALSE)

Mean plots of Cylinders

plot of chunk unnamed-chunk-5