1974 Cars Fun Factor

How do you define a car's fun factor?

Ken Lin, http://kenlin.com

What factors make a car fun to drive?

You get to experiment and decide with the 1974 Cars Fun Factors web app!

Create your fun factor by multiplying or dividing any combination of variables from mtcars

var description var description var description
mpg Miles/(US) gallon drat Rear axle ratio am Transmission (0=auto, 1=man)
cyl Number of cylinders wt Weight (lb/1000) gear Number of forward gears
disp Displacement (cu.in.) qsec 1/4 mile time carb Number of carburetors
hp Gross horsepower vs Engine (0=V, 1=Straight)

If you're into mathematical notation, the calcFun() function on the next page does this ... \(fun=\frac{\displaystyle\prod_{n~\in~funFactors}{n}}{\displaystyle\prod_{d~\in~funDenominators}{d}}\)

calcFun() calculates your fun factors ...

calcFun <- function(cars, funFactors, funDenominators) {
  fun <- seq(1, length=nrow(cars), by=0) # all 1s
  if (length(funFactors) > 0) { 
    for (i in 1:length(funFactors)) {
      fun <- fun * cars[,funFactors[i]]
    }
  }
  if (length(funDenominators) > 0) {
    for (i in 1:length(funDenominators)) {
      fun <- fun / cars[,funDenominators[i]]      
    }
  }
  return(fun)
}

cars <- mtcars

... which is then stored in cars$fun

cars$fun <- calcFun(cars, 'hp', 'qsec')  # New 'fun' column contains hp/qsec
head(cars)
##                    mpg cyl disp  hp drat    wt  qsec vs am gear carb
## Mazda RX4         21.0   6  160 110 3.90 2.620 16.46  0  1    4    4
## Mazda RX4 Wag     21.0   6  160 110 3.90 2.875 17.02  0  1    4    4
## Datsun 710        22.8   4  108  93 3.85 2.320 18.61  1  1    4    1
## Hornet 4 Drive    21.4   6  258 110 3.08 3.215 19.44  1  0    3    1
## Hornet Sportabout 18.7   8  360 175 3.15 3.440 17.02  0  0    3    2
## Valiant           18.1   6  225 105 2.76 3.460 20.22  1  0    3    1
##                         fun
## Mazda RX4          6.682868
## Mazda RX4 Wag      6.462985
## Datsun 710         4.997313
## Hornet 4 Drive     5.658436
## Hornet Sportabout 10.282021
## Valiant            5.192878

Try it yourself!

Go to kenlin.shinyapps.io and try it yourself!

Here's some fun factor formulas you might want to try...

numerators denominators x axis comment
hp qsec wt These are the default settings - Maserati Bora wins
hp wt The classic horse power to weight ratio plot. Not much different than the plot above - Maserati wins
qsec wt Based on quarter mile speed alone - Ford Pantera now wins
qsec mpg The Lotus Europa would be my green fun car - it does the quarter mile in 16.9 sec and gets 30.4 mpg