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
19 lines (15 loc) · 718 Bytes
/
plot1.R
File metadata and controls
19 lines (15 loc) · 718 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
## Loading required libraries
library(gsubfn)
library(proto)
library(RSQLite)
library(DBI)
library(tcltk)
library(sqldf)
# Create data frame by reading the input file and filtering out the content.
household <- read.csv.sql("household_power_consumption.txt", sql = "select * from file where Date IN ('1/2/2007','2/2/2007')", header = TRUE, sep = ";")
## Open PNG device; create "plot1.png" in working directory
png(file = "plot1.png", width = 480, height = 480, units = "px")
## Creating histogram plot
hist(household$Global_active_power, col = "red", xlab = "Global Active Power (kilowatts)", main = "Global Active Power")
unlink(household) ## Closing the data frame
dev.off() ## Close the PNG file device