Reading the data

Txtfile <- "F:/Exploratory Data Analysis/Week 1/Programming Assignment 1/household_power_consumption.txt"
data <- read.table(Txtfile, header=TRUE, sep=";", stringsAsFactors=FALSE, dec=".")
data1 <- data[data$Date %in% c("1/2/2007","2/2/2007") ,]
datetime <- strptime(paste(data1$Date, data1$Time, sep=" "), "%d/%m/%Y %H:%M:%S")

Analysing Histogram Of Global Active Power

str(data1)
## 'data.frame':    2880 obs. of  9 variables:
##  $ Date                 : chr  "1/2/2007" "1/2/2007" "1/2/2007" "1/2/2007" ...
##  $ Time                 : chr  "00:00:00" "00:01:00" "00:02:00" "00:03:00" ...
##  $ Global_active_power  : chr  "0.326" "0.326" "0.324" "0.324" ...
##  $ Global_reactive_power: chr  "0.128" "0.130" "0.132" "0.134" ...
##  $ Voltage              : chr  "243.150" "243.320" "243.510" "243.900" ...
##  $ Global_intensity     : chr  "1.400" "1.400" "1.400" "1.400" ...
##  $ Sub_metering_1       : chr  "0.000" "0.000" "0.000" "0.000" ...
##  $ Sub_metering_2       : chr  "0.000" "0.000" "0.000" "0.000" ...
##  $ Sub_metering_3       : num  0 0 0 0 0 0 0 0 0 0 ...
globalactivepower <- as.numeric(data1$Global_active_power)
hist(globalactivepower, col="red", main="Global Active Power", xlab="Global Active Power (kilowatts)",ylab = "Frequency")

Analysing Consumption Of Global Active Power On Specific Days

globalactivepower <- as.numeric(data1$Global_active_power)
plot(datetime, globalactivepower, type="l", xlab="", ylab="Global Active Power (kilowatts)")

Tracking Meterwise Energy Consumption On Specific Days

submetering1 <- as.numeric(data1$Sub_metering_1)
submetering2 <- as.numeric(data1$Sub_metering_2)
submetering3 <- data1$Sub_metering_3
plot(datetime,submetering1,type="l",xlab = "",ylab = "Energy Submetering")
lines(datetime,submetering2,type = "l",col="red")
lines(datetime,submetering3,type = "l", col="blue")
legend("topright",c("sub_metering_1","sub_metering_2","sub_metering_3"),lty = 1,lwd=3, col = c("black","red","blue"))

Plotting Global Active Power, Voltage, Global Reactive Power And Meterwise Energy Consumption together On Specific Days

voltage <- as.numeric(data1$Voltage)
globalreactivepower  <- as.numeric(data1$Global_reactive_power)
globalactivepower <- as.numeric(data1$Global_active_power)
submetering1 <- as.numeric(data1$Sub_metering_1)
submetering2 <- as.numeric(data1$Sub_metering_2)
submetering3 <- data1$Sub_metering_3
par(mfrow=c(2,2))
plot(datetime, globalactivepower, type="l", xlab="", ylab="Global Active Power (kilowatts)")
plot(datetime,voltage,type="l",xlab = "datetime",ylab = "Voltage")
plot(datetime,submetering1,type="l",xlab = "",ylab = "Energy Submetering")
lines(datetime,submetering2,type = "l",col="red")
lines(datetime,submetering3,type = "l", col="blue")
legend("topright",c("sub_metering_1","sub_metering_2","sub_metering_3"),lty = 1,lwd=3, col = c("black","red","blue"))
plot(datetime,globalreactivepower,type="l",xlab = "datetime",ylab = "Global_reactive_power")

Conclusion

It was found that kitchen consumes most power in comparison when all meters are in use. Sub-meter 1 consumes the highest electric power while sub-meter 3 consumes the least power.