Sameer Mathur
attach(mtcars)
boxplot(mpg,data=mtcars,
main="Box Plot",
ylab="Miles Per Gallon")
boxplot(mpg~am,data=mtcars,
main="Car Milage Data",
xlab="Number of Cylinders",
ylab="Miles Per Gallon")
Create a factor for transmission type
mtcars$am.f <- factor(mtcars$am,
levels=c(0,1),
labels=c("Automatic","Manual"))
boxplot(mpg~cyl,data=mtcars,
main="Car Milage Data",
xlab="Number of Cylinders",
ylab="Miles Per Gallon")
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"))
boxplot(mpg ~ am.f *cyl.f, data=mtcars, varwidth=TRUE,col=c("gold", "darkgreen"),
main="MPG Distribution by Auto Type",xlab="Auto Type")