Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- title: "A12 by Noah Perry & Andrew Hall"
- output:
- pdf_document: default
- html_notebook: default
- ---
- You have access to a dataset <http://www.richardtwatson.com/data/LiOnBattery.csv> containing details of projected prices of Li-On batteries. Assume GM pays $300 per kilowatt-hour for the cells in the battery pack of the 2017 Chevrolet Bolt EV, which has a capacity of 60kWh and sells for $37,500. In other words, batteries are about half the current consumer cost of the car (StorageCost*60 = $18,000), and the other components cost the consumer about $19,500.
- Use ggplot2 to create
- a point graph showing the projected cost of LiOn batteries.
- a line graph showing the projected cost of batteries for a Chevy Bolt
- a bar graph of the projected cost of a Chevy Bolt.
- Use googleVis to create one or more appropriate counterparts to those of ggplot2.
- ```{r Cleaning}
- library(tidyverse)
- library(googleVis)
- da <- read_csv("http://www.richardtwatson.com/data/LiOnBattery.csv")
- da <- da %>% rename(StorageCost = `Projected cost of Li-On Battery Storage ($/kW)`) %>%
- mutate(Year = as.integer(Year)) %>% mutate(StorageCost = as.integer(StorageCost)) %>%
- mutate(BoltStorageCost=as.integer(StorageCost*60)) %>% mutate(BoltTotalCost=as.integer(StorageCost*60+19500))
- da
- ```
- ```{r plot1}
- ggplot(da, aes(Year, StorageCost, label=Year)) + geom_point(color='red') + xlab('Year') +
- ylab('Projected cost of Li-On Battery Storage ($/kW)') + ylim(90, 200)
- ```
- ```{r plot2}
- ggplot(da, aes(Year, BoltStorageCost, label=Year)) + geom_point(color='red') + xlab('Year') +
- ylab('Projected cost of Li-On Battery Storage for 2017 Chevrolet Bolt EV ($)') + ylim(5000, 10000)
- ```
- ```{r plot3}
- Bar <- gvisBarChart(da,xvar="Year", yvar="BoltTotalCost")
- print(Bar)
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement