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
13 lines (13 loc) · 633 Bytes
/
plot2.R
File metadata and controls
13 lines (13 loc) · 633 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
data<-read.csv2("household_power_consumption.txt",header=F,
col.names=c("Date","Time","Global_active_power",
"Global_reactive_power","Voltage",
"Global_intensity","Sub_metering_1",
"Sub_metering_2","Sub_metering_3"),
colClasses="character",
skip=66637,nrows=2880,na.strings="?")
datetime<-paste(data[,1],data[,2])
datetime<-strptime(datetime,"%d/%m/%Y %H:%M:%S",tz="GMT")
png(file="plot2.png")
plot(datetime,as.numeric(data[,3]),type="l",
xlab="",ylab="Global Active Power (kilowatts)")
dev.off()