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
23 lines (18 loc) · 701 Bytes
/
Copy pathplot2.R
File metadata and controls
23 lines (18 loc) · 701 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
data <- read.csv.sql("household_power_consumption.txt",sql = "select * from file where Date = '2/2/2007' or Date = '1/2/2007'",header = TRUE, sep = ";", stringsAsFactors=FALSE)
days <-c()
for (i in 1:nrow(data)){
if(data[i,1] =="1/2/2007"){
temp <-weekdays(as.Date('01/02/07','%d/%m/%y'))
days <-c(days,temp)
}
else{
temp <-weekdays(as.Date('02/02/07','%d/%m/%y'))
days <-c(days,temp)
}
}
png('/Users/NidhiVyas/Desktop/datascience/plot2.png',width = 480, height = 480)
y <- data[,3]
lab <- c("Thu","Fri","Sat")
plot(1:2880, y,type="l",xaxt='n',xlab = "",ylab = "Global Active Power (kilowatts)")
axis(side=1, at=c(0,1440,2880), c("Thu","Fri","Sat"))
dev.off()