Created
May 12, 2014 13:38
-
-
Save tallaln/60d52a772a5da2ed001c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
household_power_consumption <- read.csv("D:/Tallal/Dropbox/Thesis/Material for R/working directory/household_power_consumption.txt", sep=";") | |
hpc <- read.table(file = "household_power_consumption.txt", sep = ";", skip = 66637, nrows = 2880) | |
hpc$V1<-as.Date(as.character(hpc$V1),"%d/%m/%Y") | |
hpc$V2<-strptime(hpc$V2,"%T") | |
rm (household_power_consumption) | |
# installs the package reshape since all the vaiable had been reassigned names | |
#such as v1, v2, V3,etc | |
#install.packages("reshape") | |
# rename interactively | |
#fix(hpc) # results are saved on close | |
# rename programmatically, | |
library(reshape) | |
# you can re-enter all the variable names in order | |
# changing the ones you need to change.the limitation | |
# is that you need to enter all of them! | |
names(hpc) <- c("Date","Time","Global_active_power", "Global_reactive_power", | |
"Voltage","Global_intensity","Sub_metering_1","Sub_metering_2", | |
"Sub_metering_3") | |
View (hpc) | |
# print plot number 1 | |
attach (hpc) | |
par (mar = c(4,4,4,2)) | |
hist (Global_active_power, col= "red",main= "Global active power",ylab="Frequency",xlab="Global Acive Power") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment