Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- title: "A23 By Andrew Hall and Noah Perry"
- output: html_notebook
- ---
- A csv file <http://www.richardtwatson.com/data/electricityprices.csv> contains hourly electricity prices for a U.S. state. Do a time series analysis of the average daily price. Use dygraph to produce a plot. What are your conclusions?
- ```{r}
- library(tidyverse)
- library(dygraphs)
- library(xts)
- url<-'http://www.richardtwatson.com/data/electricityprices.csv'
- t<-read_csv(url)
- t
- #group to average cost per day
- t$Julian<-as.integer(julian(t$timestamp))
- t2<-t%>%group_by(Julian)%>%summarise(mean(cost))
- t2
- #convert to timeseries object
- xts<-xts(t2$`mean(cost)`, order.by = as.Date(t2$Julian))
- #dygraph
- dygraph(xts)
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement