Visualizations of Three Variables from the Mtcars Dataset

Michelle Jaeger

The Dataset

  • The "mtcars" dataset comes with the R package "datasets". It is a dataframe with 32 observations (32 automobiles) on eleven variables
  • It was extracted from the 1974 Motor Trend US magazine
  • This shiny app looks at the following variables: Miles per Gallon, Horse Power, and Quarter Mile Time

Purpose of the App

There are many reasons that one might want to know how different attributes compare for different vehicle sizes. This app allows the user to choose a variable (such as horse power) and view how it compares across different sized cars.

Preprocessing

The data was divided into three groups based on automobile size.

summary(data$wt)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   1.513   2.581   3.325   3.217   3.610   5.424
small <- data[data$wt < 2.5,]
large <- data[data$wt > 3.6,]
medium <- data[data$wt >= 2.5 & data$wt <= 3.6,]

Means were calculated for each combination of variable and vehicle size

Example Barplot

plot of chunk unnamed-chunk-2