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
18 lines (13 loc) · 669 Bytes
/
plot2.R
File metadata and controls
18 lines (13 loc) · 669 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
hpc <- read.table("household_power_consumption.txt",
skip = 66637, nrow = 2880, sep = ";",na.strings="?" ,
stringsAsFactors=FALSE,
col.names = colnames(read.table(
"household_power_consumption.txt",
nrow = 1, header = TRUE, sep=";")))
#hpc$Date <- as.Date(hpc$Date, "%d/%m/%Y")
hpc <- cbind(hpc, DateTime=paste(hpc$Date,hpc$Time, sep=" "))
hpc$DateTime <- strptime(hpc$DateTime, "%d/%m/%Y %H:%M:%S")
#plot 2
png(filename ="plot2.png",width = 480, height = 480)
plot(hpc$DateTime,hpc$Global_active_power,type="l",ylab="Global Active Power (kilowatts)",xlab="")
dev.off()