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
20 lines (16 loc) · 729 Bytes
/
Copy pathplot2.R
File metadata and controls
20 lines (16 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
epc <- read.csv2("household_power_consumption.txt",
sep=";",
dec = ".",
na.strings=c("","?"),
colClasses = c("character", "character","numeric", "numeric", "numeric"
,"numeric", "numeric", "numeric", "numeric"))
#Add a column with DateTime
epc$DateTime <- strptime(paste(epc$Date, epc$Time, sep=" "), format="%d/%m/%Y %H:%M:%S")
epc[,"Date"] <- as.Date(epc[,"Date"],"%d/%m/%Y")
epc2 <- subset(epc, Date >= "2007-02-01" & Date <= "2007-02-02")
library(datasets)
with(epc2,
plot(DateTime, Global_active_power , type="l", xlab="", ylab="Global Active Power (kilowatts)")
)
dev.copy(png, file = "plot2.png")
dev.off()