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
21 lines (12 loc) · 710 Bytes
/
plot1.R
File metadata and controls
21 lines (12 loc) · 710 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
path <- "C:/Users/supriya/Documents/Rtutorial/Exploratory_Data_Analysis/"
setwd(path)
#Read in text file
options(StringsAsFactors=FALSE)
powerdat = read.table("household_power_consumption.txt", col.names = colnames(read.table("household_power_consumption.txt", nrow = 1, header = TRUE, sep=";")), sep=";", colClasses="character", na.strings ="?", skip=66637, nrows=2880)
path <- "C:/Users/supriya/Documents/Rtutorial/Exploratory_Data_Analysis/ExData_Plotting1/"
setwd(path)
#plot 1
powerdat$Global_active_power <- as.numeric(powerdat$Global_active_power)
png('plot1.png')
hist(powerdat$Global_active_power, col="red", xlab= "Global Active Power (kilowatts)", main = "Global Active Power")
dev.off()