-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConEd.Rmd
48 lines (30 loc) · 870 Bytes
/
ConEd.Rmd
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
title: "R Notebook"
output: html_notebook
---
```{r}
library(dplyr)
library(ggplot2)
```
Read the data from the CSV output from ConEd.
```{r}
df <- read.csv("~/Downloads/cned_electric_interval_data_Service 1_2017-12-21_to_2018-10-27.csv")
```
Combine the date and time columns into one datetime column
```{r}
df <- mutate(df, reading_datetime=as.POSIXct(paste(df$DATE, df$START.TIME), format="%Y-%m-%d %H:%M"))
```
### Add a few more columns that will be useful for plotting
```{r}
df <- mutate(df, month=format(as.Date(df$DATE), "%m"))
```
### Simple line chart of usage over time
```{r}
ggplot(data = df, aes(x = reading_datetime, y = USAGE))+
geom_line(color = "#00AFBB", size = 1)
```
### Scatterplot by day.
I've set the alpha to .1 to do with the overlapping points
```{r}
ggplot(data=df, aes(x=DATE, y=USAGE)) + geom_point(alpha=0.1)
```