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