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
16 lines (8 loc) · 691 Bytes
/
plot1.R
File metadata and controls
16 lines (8 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
dfPowConsmption <- read.csv("household_power_consumption.txt", header = TRUE, sep = ";", stringsAsFactors=FALSE)
dfPowConsmption$Date <- as.Date(dfPowConsmption$Date,"%d/%m/%Y")
dfPowConsmption$Time <- strptime(dfPowConsmption$Time, format = "%H:%M:%S", tz = "")
dfPowConsmptionFiltered <- dfPowConsmption[(dfPowConsmption$Date >= "2007-02-01" & dfPowConsmption$Date <= "2007-02-02"),]
dfPowConsmptionFiltered$Global_active_power <- as.numeric(dfPowConsmptionFiltered$Global_active_power)
png("plot1.png", width=480, height=480)
hist(dfPowConsmptionFiltered$Global_active_power, col="red", main="Global Active Power", xlab="Global Active Power (kilowatts)")
dev.off()