-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot1.R
More file actions
20 lines (11 loc) · 683 Bytes
/
plot1.R
File metadata and controls
20 lines (11 loc) · 683 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
if (!file.exists("./data/household_power_consumption.txt")) {
download.file("http://j.mp/TbC79E", "./data/power_data.zip", method = "wget")
unzip("./data/power_data.zip", overwrite = T, exdir = "./data")
}
datafile <- "./data/feb2007data.txt"
data <- read.table(datafile, sep = ";", header = T, na.strings = "?")
data$Datetime <- strptime(paste(data$Date, data$Time), "%d/%m/%Y %H:%M:%S")
library(datasets)
with(faithful, hist(data$Global_active_power, main = "Global Active Power", ylab = "Frequency", xlab = "Global Active Power (kilowatts)", col = "red", breaks = 13, ylim = c(0, 1200), xlim = c(0, 6), xaxp = c(0, 6, 3)))
dev.copy(png, file = "plot1.png")
dev.off()