Skip to content

Commit 1812ccb

Browse files
committed
Create plot1.R
1 parent 73fe5c6 commit 1812ccb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

plot1.R

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## This program reads a subset of "household_power_consumption.txt" file and creates a histogram
2+
## on the Global_active_power column. The histogram is saved as a .png file named "plot1.png"
3+
4+
5+
input <- read.table("household_power_consumption.txt",skip=66637,nrow=2880,sep=";",
6+
col.names=colnames(read.table("household_power_consumption.txt",nrow=1,header=TRUE,sep=";")))
7+
8+
## create .png file of the histogram
9+
png("plot1.png",width=480,height=480)
10+
hist(input$Global_active_power,main="Global Active Power",xlab="Global Active Power(kilowatts)",ylab="Frequency",col="red")
11+
dev.off() ## Close graphics file

0 commit comments

Comments
 (0)