-
Notifications
You must be signed in to change notification settings - Fork 56.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assigment 1 #952
Comments
Why! |
household_power_consumption= read.table ("household_power_consumption.txt",
header= T, sep= ";", dec= ".")
library("dplyr")
household_power_consumption$Date= as.Date (household_power_consumption$Date,
format= "%d/%m/%Y")
household_power_consumption= subset (household_power_consumption,
Date >= "2007-02-01" & Date <= "2007-02-02" )
household_power_consumption [ , c(3:9)]= apply (household_power_consumption [ , c(3:9)],
2, function (x) as.numeric (x))
household_power_consumption$DateTime=as.POSIXct(paste(household_power_consumption$Date,household_power_consumption$Time))
#101
hist (household_power_consumption$Global_active_power,
col= "red", main= "Global Active Power",
xlab = "Global Active Power (kilowatts)")
dev.copy(png,file="plot1.png")
dev.off()
#65
plot (household_power_consumption$DateTime,
household_power_consumption$Global_active_power,
type= "l", ylab= "Global Active Power (kilowatts)", xlab= "")
#66
plot (household_power_consumption$DateTime,
household_power_consumption$Sub_metering_1, xlab= "", ylab="Energy sub metering")
lines (household_power_consumption$DateTime,
household_power_consumption$Sub_metering_2, col="red")
lines (household_power_consumption$DateTime,
household_power_consumption$Sub_metering_3, col="blue")
legend ("topright", col= c("black", "red", "blue"),
legend= c("Sub_metering_1", "Sub_metering_2", "Sub_metering_3"),
lwd = 2, lty=1, cex= 0.75)
dev.copy(png,file="plot3.png",width=480, height=480)
dev.off()
#115
par (mfrow= c(2,2), mar= (c(4, 4, 2, 1)))
plot (household_power_consumption$DateTime,
household_power_consumption$Global_active_power,
type= "l", ylab= "Global Active Power (kilowatts)", xlab= "")
plot (household_power_consumption$DateTime,
household_power_consumption$Voltage,
type= "l", ylab= "Voltage", xlab= "Daytime")
plot (household_power_consumption$DateTime,
household_power_consumption$Sub_metering_1, xlab= "", ylab="Energy sub metering")
lines (household_power_consumption$DateTime,
household_power_consumption$Sub_metering_2, col="red")
lines (household_power_consumption$DateTime,
household_power_consumption$Sub_metering_3, col="blue")
legend ("topright", col= c("black", "red", "blue"),
legend= c("Sub_metering_1", "Sub_metering_2", "Sub_metering_3"),
lwd = 2, lty=1, cex= 0.5)
plot (household_power_consumption$DateTime,
household_power_consumption$Global_reactive_power,
type= "l", ylab= "Global_reactive_power", xlab= "Daytime")
dev.copy(png,file="plot4.png")
dev.off()
The text was updated successfully, but these errors were encountered: