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 (16 loc) · 741 Bytes
/
Copy pathplot1.R
File metadata and controls
18 lines (16 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Assumption that "household_power_consumption.txt" is in working directory
data <- read.csv("household_power_consumption.txt",
sep=";",
stringsAsFactors=FALSE,
colClasses=c("character", "character", "numeric",
"numeric", "numeric", "numeric",
"numeric", "numeric", "numeric"),
na.strings=c("?"))
# Pull out values for Feb 1-2, 2007
data <- subset(data, Date == "1/2/2007" | Date == "2/2/2007")
# Create png file and plot histogram
png(filename="plot1.png", bg="transparent")
hist(data$Global_active_power, main="Global Active Power",
xlab="Global Active Power (kilowatts)",
col="red")
dev.off()