forked from rdpeng/ExData_Plotting1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot2.R
More file actions
20 lines (15 loc) · 725 Bytes
/
plot2.R
File metadata and controls
20 lines (15 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# plot2.R
df <- read.table("household_power_consumption.txt",
skip = 66637, nrow = 2880, sep = ";",
col.names = colnames(read.table(
"household_power_consumption.txt",
nrow = 1, header = TRUE, sep=";")))
png("plot2.png")
# turn off locale-specific sorting
Sys.setlocale("LC_TIME", "C")
# combine the date and time character columns and convert them into
# Date-time format in order to access the day of the week
w <- strptime(paste(df$Date, df$Time), format = "%d/%m/%Y %H:%M:%S")
# plot Global active power across the week days of data
plot(w, df$Global_active_power, type = "l", xlab = "", ylab = "Global Active Power (kilowatts)")
dev.off()