-
Notifications
You must be signed in to change notification settings - Fork 0
/
1Proj2Plot2.R
27 lines (23 loc) · 880 Bytes
/
1Proj2Plot2.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#####
# Author: Carolyn Clayton
# Date: 2015/01/08
# This is the import file for Course Project 1 for Exploratory Data Analysis
#####
#####
# IMPORT AND FORMAT VARIABLES
#####
require(checkpoint)
checkpoint(snapshot = "2014-12-01", project = getwd(), verbose = T)
require(data.table)
data <- fread("household_power_consumption.txt", na.strings = c("?", "NA", ""), verbose = TRUE)
data$Date <- as.Date(data$Date, format = "%d/%m/%Y")
data <- data[data$Date >= "2007-02-01" & data$Date <= "2007-02-02"]
data$Global_active_power <- as.numeric(data$Global_active_power)
data$DateTime <- as.POSIXct(paste(as.character(data$Date),as.character(data$Time)))
#####
# PLOT 2
#####
with(data, plot(DateTime, Global_active_power, ylab = "Global Active Power (kilowatts)", xlab = "", type = "n"))
with(data, lines(DateTime, Global_active_power))
dev.copy(png, file = "plot2.png")
dev.off()