forked from rdpeng/ExData_Plotting1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot1.R
27 lines (23 loc) · 728 Bytes
/
plot1.R
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
26
27
# common code to load the dates in question
full <-
read.table(
"household_power_consumption.txt", header = TRUE, sep = ";",na.strings =
"?"
)
dates <- as.Date(full$Date, "%d/%m/%Y")
datetimes <-
strptime(paste(full$Date, full$Time), format = "%d/%m/%Y %H:%M:%S", tz =
"UTC")
full$POSIXlt <- datetimes
ourdata <-
subset(full, ((datetimes$year == 107) &
(datetimes$mon == 1) &
((datetimes$mday == 1) | (datetimes$mday == 2)
)))
# end common code to load the dates in question
png(filename = "plot1.png")
hist(
ourdata$Global_active_power, col = "red", main = "Global Active Power",xlab =
"Global Active Power (kilowatts)"
)
dev.off()