John Bonsak
24 January 2016
Coursera project assignment
I made this Shiny Application as the project submission in the course “Developing Data Products” delivered through coursera by Johns Hopkins University
A look at cars with electric motors
While we're waiting for hydrogen/fuel cell cars, I thought a closer look at electric, hybrid and plug-in hybrid cars was about time. Here you can play with some data for such vehicle models from 2010 through 2016
evMotor variable's content to extract motor kW, battery size and battery typeyouSaveSpend variable is directly from fueleconomy.gov, and is their representation of an estimate of how much you save or spend extra on a given car over a 5 year period, compared against an average carlibrary(dplyr)
library(RCurl)
data <- getURL("https://goo.gl/Im1AeK", # github
ssl.verifypeer=0L,
followlocation=1L)
elcars <- read.csv(text=data)
glimpse(sample_n(elcars, 10, replace=FALSE), width=90)
Observations: 10
Variables:
$ id (int) 32005, 35779, 32798, 37092, 30980, 37057, 35791, 31612, 32...
$ youSaveSpend (int) 1750, 0, -1500, 3000, 2000, 1500, 1250, -2750, -250, 250
$ fuelCost08 (int) 850, 1200, 1500, 600, 1000, 900, 950, 1750, 1250, 1150
$ year (int) 2011, 2015, 2013, 2016, 2011, 2016, 2015, 2012, 2013, 2015
$ make (fctr) Kia, Lexus, Porsche, Toyota, Chevrolet, Lexus, Subaru, Vo...
$ model (fctr) Optima Hybrid, GS 450h, Panamera S Hybrid, Prius c, Volt,...
$ atvType (fctr) Hybrid, Hybrid, Hybrid, Hybrid, Plug-in Hybrid, Hybrid, H...
$ drive (fctr) Front-Wheel Drive, Rear-Wheel Drive, Rear-Wheel Drive, Fr...
$ VClass (fctr) Midsize Cars, Midsize Cars, Large Cars, Compact Cars, Com...
$ evMotor (fctr) 270V Li-Ion, 288V Ni-MH, 288V Ni-MH, 144V Ni-MH, 111 kW, ...
$ evMotorBatterySize (int) 270, 288, 288, 144, NA, 245, 101, 288, 288, 144
$ evMotorBatteryType (fctr) Li-Ion, Ni-MH, Ni-MH, Ni-MH, NA, Ni-MH, Ni-MH, Ni-MH, Ni-...
$ evMotorElKW (int) NA, NA, NA, NA, 111, NA, NA, NA, NA, NA
Note that there are four tabs in the app's navigation bar: Prediction, Plot, Data and About. The full user instructions are in the “About” tab
The images shown in the “Prediction” tab are just three random cars for each of the two prediction models, but are related to the kW or battery size you select
Try the app here: https://jbonsak.shinyapps.io/coursera-atvcars-app/
Code and app contents on github: https://github.com/jbonsak/coursera-atvcars-app