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
27 lines (15 loc) · 808 Bytes
/
plot2.R
File metadata and controls
27 lines (15 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#20150112
#marklittle
#setwd("D:\\Rѧϰ±Ê¼Ç\\Exploratory Data Analysis\\week 1")
#fileURL<-"https://d396qusza40orc.cloudfront.net/exdata%2Fdata%2Fhousehold_power_consumption.zip"
#download.file(fileURL,destfile="./t1.zip",method="curl",extra="-k")
library(dplyr)
print("--------------")
d1<-read.table("household_power_consumption.txt",colClasses=c("character","character","character","character","character","character","character","character","character"),header=TRUE,sep=";")#
c1<-paste(d1$Date, d1$Time)
c2<-strptime(c1, "%d/%m/%Y %H:%M:%S")
d1<-cbind(d1,rDate=as.Date(c2),rTime=c2)
d2<-subset(d1,subset=(rDate =="2007-02-01" |rDate =="2007-02-02" ))
png("plot2.png",width=480,height=480)
plot(d2$rTime,d2$Global_active_power,type="l",xlab="",ylab="Global Active Power(kilowatts)")
dev.off()