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
17 lines (13 loc) · 760 Bytes
/
Copy pathplot1.R
File metadata and controls
17 lines (13 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
elec<-read.table("exdata-data-household_power_consumption\\household_power_consumption.txt", sep=";", skip=1,
col.names=c("date", "time", "active_power", "inactive_power", "voltage",
"intensity", "meter1", "meter2", "meter3"),
colClasses=c("character", "character", "character","character", "character",
"character","character", "character", "character"));
sub1<-subset(elec, date=="1/2/2007");
sub2<-subset(elec, date=="2/2/2007");
sub<-rbind(sub1, sub2);
# plot 1
active_power<-as.numeric(sub$active_power);
png("plot1.png",width=480,height=480);
hist(active_power, col="red", main="Global Active Power", xlab="Global Active Power (kilowatts");
dev.off();