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
10 lines (9 loc) · 678 Bytes
/
Copy pathplot2.R
File metadata and controls
10 lines (9 loc) · 678 Bytes
1
2
3
4
5
6
7
8
9
10
fileName="household_power_consumption.txt"
data5row <- read.table(fileName, header = TRUE, nrows = 5, sep=';', stringsAsFactors=FALSE)
classes <- sapply(data5row, class)
data <- read.table(fileName, header = TRUE, colClasses = classes, sep=';', na.strings = "?")
sdata <- data[data$Date %in% c("1/2/2007", "2/2/2007"),]
sdata$DateTime<-strptime(paste (sdata$Date, sdata$Time), format = "%d/%m/%Y %H:%M:%S" )
png(file = "plot2.png", width = 480, height = 480, units = "px", pointsize = 12, bg = "white")
plot(sdata$DateTime, sdata$Global_active_power, type="l",xlab="", ylab="Global ACtive Power (kilowatts)",main="Global ACtive Power (kilowatts)",font.lab = 2,lwd=1)
dev.off()