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 (15 loc) · 730 Bytes
/
plot1.R
File metadata and controls
16 lines (15 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
plot1 <- function() {
## Read household_power_consumption data
## The separator is semicolon, instead of comma.
## Missing data are described as "?" character, so I specified the
## na.strings attribute.
csv <- read.csv("household_power_consumption.txt",sep=";",
colClasses=c("character", "character", "numeric","numeric",
"numeric","numeric","numeric","numeric","numeric"),
na.strings=c("?"))
active_power <- csv[csv$Date == "1/2/2007" | csv$Date == "2/2/2007",]$Global_active_power
hist(active_power, col="red",
main="Global Active Power", xlab="Global Active Power (kilowatts)")
dev.copy(png,"plot1.png")
dev.off()
}