Skip to content

Instantly share code, notes, and snippets.

@OliverBears
OliverBears / Global.R
Last active December 16, 2015 03:59
This is user interface to display energy consumption and energy cost with time (Daily and Monthly). There are two dataframes generated in the global.R. Based on the input of time, a right dataframe should be chosen, either shinyday or shinymonth. After inputting the start day and end day by users, the server.R will do a comparison with the time …
library(chron)
library(shiny)
energy1=c(76.1,77,78.1,78.2,78.8,79.7,79.9,81.1,81.2,81.8,82.8,83.5)
cost1=c(7.1,7,7.1,7.2,7.8,7.7,7.9,8.1,8.2,8.8,8.8,8.5)
time1=c(20130301,20130401,20130501,20130601,20130701,20130801,20130901,20131001,20131101,20131201,20140101,20140201)
time1=as.Date(as.character(time1),format="%Y%m%d")
shinymonth=data.frame(time=time1,energy=energy1,cost=cost1)