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
20 lines (13 loc) · 735 Bytes
/
Copy pathplot1.R
File metadata and controls
20 lines (13 loc) · 735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
temp <- tempfile()
download.file("https://d396qusza40orc.cloudfront.net/exdata%2Fdata%2Fhousehold_power_consumption.zip",temp)
#data <- read.table(unzip(temp))
data <- read.table(unzip(temp),header=T, sep=';', na.strings="?", stringsAsFactors=F)
unlink(temp)
#dataFile <- "C:/Users/Rimon Dubnov/Desktop/R Coursera/household_power_consumption.txt"
#data <- read.table(dataFile, header=T, sep=';', na.strings="?", stringsAsFactors=F)
subSetData <- data[data$Date %in% c("1/2/2007","2/2/2007") ,]
#str(subSetData)
globalActivePower <- as.numeric(subSetData$Global_active_power)
png("plot1.png", width=480, height=480)
hist(globalActivePower, col="red", main="Global Active Power", xlab="Global Active Power (kilowatts)")
dev.off()