forked from rdpeng/ExData_Plotting1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot1.R
More file actions
18 lines (13 loc) · 679 Bytes
/
plot1.R
File metadata and controls
18 lines (13 loc) · 679 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 1
png(filename ="plot1.png",width = 480, height = 480)
hist(hpc$Global_active_power, col="red", main="Global Active Power", xlab="Global Active Power (kilowatts)")
dev.off()