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
24 lines (17 loc) · 643 Bytes
/
Copy pathplot1.R
File metadata and controls
24 lines (17 loc) · 643 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Project 1
#
# set working dir
setwd("C:/Users/masak_000/SkyDrive/Documents/cousera/exdata/Project1")
# set a file name which is loaded
filepath <- ("./data.txt")
# load data
x <- read.table(filepath, sep=";", header=TRUE, na.strings="?")
x$datetime <- strptime(paste(x$Date, x$Time), "%d/%m/%Y %H:%M:%S")
a <- subset(x, as.Date(x$datetime) %in% c(as.Date("2007-02-01"), as.Date("2007-02-02")))
# Making Histgram on the screen
hist(a$Global_active_power, col="red",
main="Global Active Power",
xlab="Global Active Power (kilowatts)")
# Copy to png file
dev.copy(png, file = "plot1.png", width=480, height=480)
dev.off()