forked from rdpeng/ExData_Plotting1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot2.R
More file actions
16 lines (14 loc) · 645 Bytes
/
plot2.R
File metadata and controls
16 lines (14 loc) · 645 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
PlotGlobalActivePowerOverWeek<-function(data){
data[,Date:=as.Date(data$Date, format="%d/%m/%Y")]
data[,WeekDayStr:=format(Date, "%a")]
data[,WeekDayNo:=as.numeric(format(Date, "%w"))]
# todo rank by day
plotData<-data[WeekDayNo>3,]
plotData<-plotData[order(rank(WeekDayNo,Time)),]
plot(plotData$Global_active_power,
type="h", xlab = plotData$WeekDayStr , ylab = "Global active")
# png("plot2.png", width = 480, height=480)
# hist(data$Global_active_power, col=c("red"), main="Global Active Power",
# xlab="Global Active Power (kilowatts)", ylab="Frequency")
# dev.off()
}