R Markdown

Final Project for Intro To Urban Analytics: Chunk 1: Read csv files, test code for delays per specific train number (*Not Used), calculate delays for specific days in March 2018. Chunk 2: Calculate/Summarize and Display train delays for overall months per season. Chunk 3: Display and Summarize delays for specific days in March.

library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.3.6     ✔ purrr   0.3.4
## ✔ tibble  3.1.8     ✔ dplyr   1.0.9
## ✔ tidyr   1.2.0     ✔ stringr 1.4.0
## ✔ readr   2.1.2     ✔ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
library(tidycensus)
library(osmdata)
## Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright
library(sfnetworks)
library(units)
## udunits database from C:/Program Files/R/R-4.2.1/library/units/share/udunits/udunits2.xml
library(sf)
## Linking to GEOS 3.9.1, GDAL 3.4.3, PROJ 7.2.1; sf_use_s2() is TRUE
library(tidygraph)
## 
## Attaching package: 'tidygraph'
## 
## The following object is masked from 'package:stats':
## 
##     filter
library(tmap)
library(dotenv)
library(viridis)
## Loading required package: viridisLite
library(dplyr)
library(ggplot2)
library(units)
library(leaflet)
library(leafsync)
library(dbscan)
library(tigris)
## To enable caching of data, set `options(tigris_use_cache = TRUE)`
## in your R script or .Rprofile.
library(plotly)
## 
## Attaching package: 'plotly'
## 
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## 
## The following object is masked from 'package:stats':
## 
##     filter
## 
## The following object is masked from 'package:graphics':
## 
##     layout
library(here)
## here() starts at C:/Users/sbaghel3/OneDrive - Georgia Institute of Technology/Desktop/transitDelays
library(patchwork)
library(rgdal)
## Loading required package: sp
## Please note that rgdal will be retired by the end of 2023,
## plan transition to sf/stars/terra functions using GDAL and PROJ
## at your earliest convenience.
## 
## rgdal: version: 1.5-32, (SVN revision 1176)
## Geospatial Data Abstraction Library extensions to R successfully loaded
## Loaded GDAL runtime: GDAL 3.4.3, released 2022/04/22
## Path to GDAL shared files: C:/Program Files/R/R-4.2.1/library/rgdal/gdal
## GDAL binary built with GEOS: TRUE 
## Loaded PROJ runtime: Rel. 7.2.1, January 1st, 2021, [PJ_VERSION: 721]
## Path to PROJ shared files: C:/Program Files/R/R-4.2.1/library/rgdal/proj
## PROJ CDN enabled: FALSE
## Linking to sp version:1.5-0
## To mute warnings of possible GDAL/OSR exportToProj4() degradation,
## use options("rgdal_show_exportToProj4_warnings"="none") before loading sp or rgdal.
library(mapview)
library(tidyr)
library(lubridate)
## 
## Attaching package: 'lubridate'
## 
## The following objects are masked from 'package:base':
## 
##     date, intersect, setdiff, union
local3861Data <-
  read.csv("3861.csv")

head(local3861Data)
##       date train_id stop_sequence                  from from_id
## 1 3/1/2018     3861             1 New York Penn Station     105
## 2 3/1/2018     3861             2 New York Penn Station     105
## 3 3/1/2018     3861             3    Secaucus Upper Lvl   38187
## 4 3/1/2018     3861             4   Newark Penn Station     107
## 5 3/1/2018     3861             5        Newark Airport   37953
## 6 3/1/2018     3861             6       North Elizabeth     109
##                      to to_id scheduled_time    actual_time delay_minutes
## 1 New York Penn Station   105 3/1/2018 16:29 3/1/2018 16:29     0.2833333
## 2    Secaucus Upper Lvl 38187 3/1/2018 16:38 3/1/2018 16:41     3.2833333
## 3   Newark Penn Station   107 3/1/2018 16:50 3/1/2018 16:50     0.2333333
## 4        Newark Airport 37953 3/1/2018 16:56 3/1/2018 16:56     0.3000000
## 5       North Elizabeth   109 3/1/2018 16:59 3/1/2018 16:59     0.3000000
## 6             Elizabeth    41 3/1/2018 17:02 3/1/2018 17:02     0.2000000
##     status             line       type
## 1 departed Northeast Corrdr NJ Transit
## 2 departed Northeast Corrdr NJ Transit
## 3 departed Northeast Corrdr NJ Transit
## 4 departed Northeast Corrdr NJ Transit
## 5 departed Northeast Corrdr NJ Transit
## 6 departed Northeast Corrdr NJ Transit
typeof(local3861Data)
## [1] "list"
local3861Data$delay_minutes
##  [1] 0.28333333 3.28333333 0.23333333 0.30000000 0.30000000 0.20000000
##  [7] 0.20000000 0.23333333 1.21666667 1.20000000 0.21666667 0.20000000
## [13] 0.00000000 0.00000000 0.00000000 0.00000000 0.16666667 0.00000000
## [19] 0.21666667 0.33333333 0.23333333 0.33333333 0.18333333 1.28333333
## [25] 1.28333333 0.33333333 0.23333333 0.00000000 0.00000000 0.00000000
## [31] 0.00000000 0.21666667 0.21666667 0.11666667 1.11666667 0.20000000
## [37] 1.18333333 0.06666667 2.13333333 1.18333333 0.10000000 1.15000000
## [43] 0.00000000 0.00000000 0.00000000 0.00000000 0.18333333 0.00000000
## [49] 0.00000000 0.13333333 0.20000000 0.15000000 0.23333333 1.15000000
## [55] 0.23333333 0.16666667 0.25000000 0.00000000 0.00000000 0.00000000
local3861DelayinMinutesforMarch1 <- with(local3861Data, sum(delay_minutes[date == '3/1/2018']))
local3861DelayinMinutesforMarch1
## [1] 7.866667
with(local3861Data, sum(delay_minutes[date == '3/1/2018' & (stop_sequence == '1' | stop_sequence == '2')]))
## [1] 3.566667
local3861DelayinMinutesforMarch15 <- with(local3861Data, sum(delay_minutes[date == '3/15/2018']))
local3861DelayinMinutesforMarch22 <- with(local3861Data, sum(delay_minutes[date == '3/22/2018']))
local3861DelayinMinutesforMarch29 <- with(local3861Data, sum(delay_minutes[date == '3/29/2018']))

delayinMinutesofTrain <- c(local3861DelayinMinutesforMarch1, local3861DelayinMinutesforMarch15, local3861DelayinMinutesforMarch22, local3861DelayinMinutesforMarch29)

dateOfTrain <- c("March 1", "March 15", "March 22", "March 29")

png(file = "barchart_delay3861Local.png")

barplot(delayinMinutesofTrain, names.arg=dateOfTrain, xlab="Date", ylab="Delay In Min", col="red", main="Delay Chart for Local 3861", border="blue")

dev.off
## function (which = dev.cur()) 
## {
##     if (which == 1) 
##         stop("cannot shut down device 1 (the null device)")
##     .External(C_devoff, as.integer(which))
##     dev.cur()
## }
## <bytecode: 0x0000028ba4d6fdd0>
## <environment: namespace:grDevices>
allTrainsMarch2018Data <- read.csv("march2018Delays.csv")
allTrainsApril2018Data <- read.csv("april2018Delays.csv")
allTrainsAugust2018Data <- read.csv("august2018Delays.csv")
allTrainsJune2018Data <- read.csv("june2018Delays.csv")
allTrainsSeptember2018Data <- read.csv("september2018Delays.csv")
allTrainsDecember2018Data <- read.csv("december2018Delays.csv")


#totalinMinutesforMarch <- "totalDelayinMinutesforMarch"

totalDelayperDayinMinutes <- c()

totalMarchDelaydf <- data.frame(totalDelayperDayinMinutes)

totalMarchDelaydf
## data frame with 0 columns and 0 rows
x = 1

paste0('3/',as.character(x),'/2018')
## [1] "3/1/2018"
with(allTrainsMarch2018Data, sum(delay_minutes[date == paste0('3/',as.character(x),'/2018')]))
## [1] 9190.117
#delayStore <- numeric(31)

sumofMarch1Delays <- with(allTrainsMarch2018Data, sum(delay_minutes[date == '3/1/2018']))

typeof(sumofMarch1Delays)
## [1] "double"
totalrowsMarch12018 <- allTrainsMarch2018Data %>% select(delay_minutes, date) %>% filter(date == "3/1/2018")

totalrowsMarch152018 <- allTrainsMarch2018Data %>% select(delay_minutes, date) %>% filter(date == "3/15/2018")

totalrowsMarch222018 <- allTrainsMarch2018Data %>% select(delay_minutes, date) %>% filter(date == "3/22/2018")

totalrowsMarch292018 <- allTrainsMarch2018Data %>% select(delay_minutes, date) %>% filter(date == "3/29/2018")

totalrowsMarch212018 <- allTrainsMarch2018Data %>% select(delay_minutes, date) %>% filter(date == "3/21/2018")

totalrowsMarch22018 <- allTrainsMarch2018Data %>% select(delay_minutes, date) %>% filter(date == "3/2/2018")

totalrowsMarch72018 <- allTrainsMarch2018Data %>% select(delay_minutes, date) %>% filter(date == "3/7/2018")

#totalrowsMarch12018

mean(totalrowsMarch12018$delay_minutes)
## [1] 6.277402
mean(totalrowsMarch152018$delay_minutes)
## [1] 3.909953
mean(totalrowsMarch222018$delay_minutes)
## [1] 3.862648
mean(totalrowsMarch292018$delay_minutes)
## [1] 2.848815
marchDaysCombined <- rbind(totalrowsMarch12018,totalrowsMarch152018,totalrowsMarch222018,totalrowsMarch292018,totalrowsMarch212018,totalrowsMarch22018, totalrowsMarch72018)

#marchDaysCombined

mean(totalrowsMarch152018$delay_minutes)
## [1] 3.909953
mean(totalrowsMarch222018$delay_minutes)
## [1] 3.862648
mean(totalrowsMarch292018$delay_minutes)
## [1] 2.848815
marchDaysCombined$date <- factor(marchDaysCombined$date, levels=c("3/1/2018", "3/2/2018", "3/7/2018", "3/15/2018", "3/21/2018", "3/22/2018", "3/29/2018"))

##Plots for Monthly Delays

#plot(pressure)

delayStore <- list()

delayStoreApril2018 <- list()

delayStoreAugust2018 <- list()

delayStoreJune2018 <- list()

delayStoreSeptember2018 <- list()

delayStoreDecember2018 <- list()



typeof(delayStore)
## [1] "list"
for( i in 1:31){
  delayStore[i] <- with(allTrainsMarch2018Data, sum(delay_minutes[date == paste0('3/',as.character(i),'/2018')]))
}


for( i in 1:30){
  delayStoreApril2018[i] <- with(allTrainsApril2018Data, sum(delay_minutes[date == paste0('4/',as.character(i),'/2018')]))
}

for( i in 1:31){
  delayStoreAugust2018[i] <- with(allTrainsAugust2018Data, sum(delay_minutes[date == paste0('8/',as.character(i),'/2018')]))
}

for( i in 1:30){
  delayStoreJune2018[i] <- with(allTrainsJune2018Data, sum(delay_minutes[date == paste0('6/',as.character(i),'/2018')]))
}

for( i in 1:30){
  delayStoreSeptember2018[i] <- with(allTrainsSeptember2018Data, sum(delay_minutes[date == paste0('9/',as.character(i),'/2018')]))
}

for( i in 1:31){
  delayStoreDecember2018[i] <- with(allTrainsDecember2018Data, sum(delay_minutes[date == paste0('12/',as.character(i),'/2018')]))
}

do.call(rbind, delayStoreApril2018)
##            [,1]
##  [1,]  1376.350
##  [2,]  4502.483
##  [3,]  4172.800
##  [4,]  9157.350
##  [5,]  8168.667
##  [6,]  5657.267
##  [7,]  3713.733
##  [8,]  3779.683
##  [9,]  5164.817
## [10,]  5214.100
## [11,]  3692.283
## [12,]  6017.033
## [13,]  7226.850
## [14,]  2645.267
## [15,]  2184.267
## [16,]  6047.333
## [17,]  5854.350
## [18,]  4680.267
## [19,]  4656.650
## [20,]  6193.667
## [21,]  2718.883
## [22,]  2766.917
## [23,] 10752.400
## [24,]  8108.917
## [25,]  5242.883
## [26,]  6436.033
## [27,]  4392.317
## [28,]  2875.817
## [29,]  3345.650
## [30,]  4844.867
delayCheckApril2018 <- do.call(rbind, delayStoreApril2018)
colnames(delayCheckApril2018)[1] <- "DelayinMin"
data_delayCheckApril2018 <- as.data.frame(delayCheckApril2018)
data_delayCheckApril2018$Month <- ("April")
#head(data_delayCheckApril2018)

do.call(rbind, delayStoreAugust2018)
##            [,1]
##  [1,]  6116.917
##  [2,]  5436.050
##  [3,]  6485.200
##  [4,]  3275.867
##  [5,]  3538.000
##  [6,]  5870.083
##  [7,]  5115.717
##  [8,]  4399.233
##  [9,] 12797.483
## [10,]  7003.783
## [11,]  2866.017
## [12,]  2780.700
## [13,]  5663.867
## [14,]  4921.450
## [15,]  5689.933
## [16,]  4902.033
## [17,]  6486.000
## [18,]  2953.833
## [19,]  3068.433
## [20,]  4981.683
## [21,]  4919.650
## [22,]  9248.350
## [23,]  5448.533
## [24,]  6558.667
## [25,]  4684.500
## [26,]  5892.817
## [27,]  4131.767
## [28,]  5864.983
## [29,]  4347.300
## [30,]  3581.617
## [31,]  4588.233
delayCheckAugust2018 <- do.call(rbind, delayStoreAugust2018)
colnames(delayCheckAugust2018)[1] <- "DelayinMin"
data_delayCheckAugust2018 <- as.data.frame(delayCheckAugust2018)
data_delayCheckAugust2018$Month <- ("August")
#head(data_delayCheckAugust2018)

do.call(rbind, delayStoreJune2018)
##           [,1]
##  [1,] 7953.150
##  [2,] 2422.250
##  [3,] 2454.067
##  [4,] 4954.817
##  [5,] 4644.067
##  [6,] 3649.200
##  [7,] 3856.150
##  [8,] 5093.917
##  [9,] 2493.467
## [10,] 2082.733
## [11,] 4613.333
## [12,] 5453.117
## [13,] 3890.450
## [14,] 4442.817
## [15,] 4760.650
## [16,] 2698.733
## [17,] 2596.617
## [18,] 6079.967
## [19,] 7197.050
## [20,] 4570.867
## [21,] 4674.567
## [22,] 4440.450
## [23,] 2657.983
## [24,] 2669.500
## [25,] 4426.517
## [26,] 3421.717
## [27,] 5777.850
## [28,] 5488.583
## [29,] 6605.117
## [30,] 2647.583
delayCheckJune2018 <- do.call(rbind, delayStoreJune2018)
colnames(delayCheckJune2018)[1] <- "DelayinMin"
data_delayCheckJune2018 <- as.data.frame(delayCheckJune2018)
data_delayCheckJune2018$Month <- ("June")
#head(data_delayCheckJune2018)

do.call(rbind, delayStoreSeptember2018)
##            [,1]
##  [1,]  2184.150
##  [2,]  1998.067
##  [3,]  3131.483
##  [4,]  4263.833
##  [5,] 12103.000
##  [6,]  4247.000
##  [7,]  7552.167
##  [8,]  3489.200
##  [9,]  5826.100
## [10,]  7387.383
## [11,]  5296.333
## [12,]  4144.283
## [13,]  4897.000
## [14,]  4682.417
## [15,]  2322.367
## [16,]  2933.400
## [17,]  5439.917
## [18,]  4148.667
## [19,]  5102.317
## [20,]  5780.800
## [21,]  3868.450
## [22,]  3181.617
## [23,]  2300.283
## [24,]  5347.333
## [25,]  5182.967
## [26,]  4320.583
## [27,]  4180.833
## [28,]  5717.100
## [29,]  2377.333
## [30,]  2639.667
delayCheckSeptember2018 <- do.call(rbind, delayStoreSeptember2018)
colnames(delayCheckSeptember2018)[1] <- "DelayinMin"
data_delayCheckSeptember2018 <- as.data.frame(delayCheckSeptember2018)
data_delayCheckSeptember2018$Month <- ("September")
#head(data_delayCheckSeptember2018)

do.call(rbind, delayStoreDecember2018)
##            [,1]
##  [1,]  3099.517
##  [2,]  3824.100
##  [3,]  5335.083
##  [4,]  5334.167
##  [5,]  7374.283
##  [6,]  6724.917
##  [7,] 11893.800
##  [8,]  7758.600
##  [9,]  6290.250
## [10,] 14459.150
## [11,]  6025.633
## [12,]  6701.533
## [13,]  7259.517
## [14,]  6510.267
## [15,]  3588.083
## [16,]  5029.700
## [17,]  7328.017
## [18,]  7155.933
## [19,]  6740.667
## [20,]  6060.100
## [21,]  5634.783
## [22,]  4211.650
## [23,]  3184.667
## [24,]  4867.667
## [25,]  2876.150
## [26,]  4221.783
## [27,]  4178.767
## [28,]  4785.667
## [29,]  3875.267
## [30,]  2787.850
## [31,]  4293.333
delayCheckDecember2018 <- do.call(rbind, delayStoreDecember2018)
colnames(delayCheckDecember2018)[1] <- "DelayinMin"
data_delayCheckDecember2018 <- as.data.frame(delayCheckDecember2018)
data_delayCheckDecember2018$Month <- ("December")
#head(data_delayCheckDecember2018)




print(delayStore)
## [[1]]
## [1] 9190.117
## 
## [[2]]
## [1] 12944.98
## 
## [[3]]
## [1] 2235
## 
## [[4]]
## [1] 3433.717
## 
## [[5]]
## [1] 4316.183
## 
## [[6]]
## [1] 5415.733
## 
## [[7]]
## [1] 6528.033
## 
## [[8]]
## [1] 1996.367
## 
## [[9]]
## [1] 12790.55
## 
## [[10]]
## [1] 3357.1
## 
## [[11]]
## [1] 3524.217
## 
## [[12]]
## [1] 7172.55
## 
## [[13]]
## [1] 5945.95
## 
## [[14]]
## [1] 3745.683
## 
## [[15]]
## [1] 5775
## 
## [[16]]
## [1] 11008.83
## 
## [[17]]
## [1] 3255.317
## 
## [[18]]
## [1] 2272.35
## 
## [[19]]
## [1] 5044.833
## 
## [[20]]
## [1] 5342.967
## 
## [[21]]
## [1] 2817.983
## 
## [[22]]
## [1] 5878.95
## 
## [[23]]
## [1] 4142.2
## 
## [[24]]
## [1] 4017.633
## 
## [[25]]
## [1] 3999.833
## 
## [[26]]
## [1] 3997.95
## 
## [[27]]
## [1] 4286.5
## 
## [[28]]
## [1] 3695.867
## 
## [[29]]
## [1] 4207.7
## 
## [[30]]
## [1] 5123.317
## 
## [[31]]
## [1] 2721.417
do.call(rbind.data.frame, delayStore)
##    c.9190.116666678..12944.983333328..2234.999999982..3433.71666668..
## 1                                                            9190.117
## 2                                                           12944.983
## 3                                                            2235.000
## 4                                                            3433.717
## 5                                                            4316.183
## 6                                                            5415.733
## 7                                                            6528.033
## 8                                                            1996.367
## 9                                                           12790.550
## 10                                                           3357.100
## 11                                                           3524.217
## 12                                                           7172.550
## 13                                                           5945.950
## 14                                                           3745.683
## 15                                                           5775.000
## 16                                                          11008.833
## 17                                                           3255.317
## 18                                                           2272.350
## 19                                                           5044.833
## 20                                                           5342.967
## 21                                                           2817.983
## 22                                                           5878.950
## 23                                                           4142.200
## 24                                                           4017.633
## 25                                                           3999.833
## 26                                                           3997.950
## 27                                                           4286.500
## 28                                                           3695.867
## 29                                                           4207.700
## 30                                                           5123.317
## 31                                                           2721.417
do.call(rbind, delayStore)
##            [,1]
##  [1,]  9190.117
##  [2,] 12944.983
##  [3,]  2235.000
##  [4,]  3433.717
##  [5,]  4316.183
##  [6,]  5415.733
##  [7,]  6528.033
##  [8,]  1996.367
##  [9,] 12790.550
## [10,]  3357.100
## [11,]  3524.217
## [12,]  7172.550
## [13,]  5945.950
## [14,]  3745.683
## [15,]  5775.000
## [16,] 11008.833
## [17,]  3255.317
## [18,]  2272.350
## [19,]  5044.833
## [20,]  5342.967
## [21,]  2817.983
## [22,]  5878.950
## [23,]  4142.200
## [24,]  4017.633
## [25,]  3999.833
## [26,]  3997.950
## [27,]  4286.500
## [28,]  3695.867
## [29,]  4207.700
## [30,]  5123.317
## [31,]  2721.417
delayCheck <- do.call(rbind, delayStore)

colnames(delayCheck)[1] <- "DelayinMin"


data_delayCheck <- as.data.frame(delayCheck)

data_delayCheck
##    DelayinMin
## 1    9190.117
## 2   12944.983
## 3    2235.000
## 4    3433.717
## 5    4316.183
## 6    5415.733
## 7    6528.033
## 8    1996.367
## 9   12790.550
## 10   3357.100
## 11   3524.217
## 12   7172.550
## 13   5945.950
## 14   3745.683
## 15   5775.000
## 16  11008.833
## 17   3255.317
## 18   2272.350
## 19   5044.833
## 20   5342.967
## 21   2817.983
## 22   5878.950
## 23   4142.200
## 24   4017.633
## 25   3999.833
## 26   3997.950
## 27   4286.500
## 28   3695.867
## 29   4207.700
## 30   5123.317
## 31   2721.417
data_delayCheck$Month <- ("March")

#head(data_delayCheck)
#head(data_delayCheckApril2018)

summarise(data_delayCheck, mean(DelayinMin))
##   mean(DelayinMin)
## 1         5167.253
summarise(data_delayCheckApril2018, mean(DelayinMin))
##   mean(DelayinMin)
## 1         5052.997
#head(delayCheck)

#delayCheck$DelayinMin

#summarise(delayCheck, mean(DelainMin))
median(data_delayCheck$DelayinMin)
## [1] 4207.7
median(data_delayCheckJune2018$DelayinMin)
## [1] 4441.633
median(data_delayCheckSeptember2018$DelayinMin)
## [1] 4255.417
median(data_delayCheckDecember2018$DelayinMin)
## [1] 5335.083
median(data_delayCheckApril2018$DelayinMin)
## [1] 4762.567
median(data_delayCheckAugust2018$DelayinMin)
## [1] 4981.683
allMonthsCombined2018 <- rbind(data_delayCheck,data_delayCheckApril2018,data_delayCheckAugust2018)

allSeasonsCombined2018 <- rbind(data_delayCheck,data_delayCheckJune2018,data_delayCheckSeptember2018,data_delayCheckDecember2018)

#head(allMonthsCombined2018)
#allMonthsCombined2018

allMonthsCombined2018$Month <- factor(allMonthsCombined2018$Month, levels=c("March", "April", "August"))

allSeasonsCombined2018$Month <- factor(allSeasonsCombined2018$Month, levels=c("March", "June", "September", "December"))

allMonthsCombined2018 %>%
  aov(DelayinMin ~ Month, data = .) %>%
  summary()
##             Df    Sum Sq Mean Sq F value Pr(>F)
## Month        2    772002  386001    0.07  0.932
## Residuals   89 490102846 5506774
allMonthsCombined2018 %>%
  aov(DelayinMin ~ Month, data = .) %>%
  TukeyHSD() #%>%
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = DelayinMin ~ Month, data = .)
## 
## $Month
##                   diff       lwr      upr     p adj
## April-March  -114.2560 -1546.762 1318.250 0.9802769
## August-March  110.7699 -1309.945 1531.485 0.9811446
## August-April  225.0259 -1207.480 1657.532 0.9257036
 # plot()

allSeasonsCombined2018 %>%
  aov(DelayinMin ~ Month, data = .) %>%
  TukeyHSD()
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = DelayinMin ~ Month, data = .)
## 
## $Month
##                         diff         lwr       upr     p adj
## June-March         -876.6766 -2397.10687  643.7537 0.4391922
## September-March    -632.3844 -2152.81465  888.0459 0.7000249
## December-March      620.1957  -887.72055 2128.1119 0.7073185
## September-June      244.2922 -1288.54995 1777.1344 0.9757542
## December-June      1496.8723   -23.55802 3017.3026 0.0553515
## December-September 1252.5801  -267.85024 2773.0103 0.1444953
allSeasonsCombined2018 %>%
  aov(DelayinMin ~ Month, data = .) %>%
  summary()
##              Df    Sum Sq  Mean Sq F value Pr(>F)  
## Month         3  41417572 13805857    2.66 0.0514 .
## Residuals   118 612368054  5189560                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(allSeasonsCombined2018, aes(x = Month, y = DelayinMin, fill = Month)) +
geom_violin(show.legend = FALSE)+
geom_boxplot(width = .5, show.legend = FALSE)

ggplot(allMonthsCombined2018, aes(x = Month, y = DelayinMin, fill = Month)) +
geom_violin(show.legend = FALSE)+
geom_boxplot(width = .5, show.legend = FALSE)

Delays by days in March 2018

marchDaysCombined %>%
  aov(delay_minutes ~ date, data = .) %>%
  summary()
##               Df Sum Sq Mean Sq F value Pr(>F)    
## date           6  38654    6442   69.87 <2e-16 ***
## Residuals   9273 855053      92                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
marchDaysCombined %>%
  aov(delay_minutes ~ date, data = .) %>%
  TukeyHSD()
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = delay_minutes ~ date, data = .)
## 
## $date
##                            diff        lwr         upr     p adj
## 3/2/2018-3/1/2018    2.11752873  1.0842002  3.15085723 0.0000000
## 3/7/2018-3/1/2018    1.04102092 -0.1617733  2.24381511 0.1410963
## 3/15/2018-3/1/2018  -2.36744949 -3.4117930 -1.32310598 0.0000000
## 3/21/2018-3/1/2018  -3.16704521 -4.3640508 -1.97003962 0.0000000
## 3/22/2018-3/1/2018  -2.41475426 -3.4513840 -1.37812448 0.0000000
## 3/29/2018-3/1/2018  -3.42858693 -4.4729304 -2.38424342 0.0000000
## 3/7/2018-3/2/2018   -1.07650781 -2.2677287  0.11471313 0.1073709
## 3/15/2018-3/2/2018  -4.48497822 -5.5159713 -3.45398510 0.0000000
## 3/21/2018-3/2/2018  -5.28457395 -6.4699498 -4.09919812 0.0000000
## 3/22/2018-3/2/2018  -4.53228299 -5.5554617 -3.50910424 0.0000000
## 3/29/2018-3/2/2018  -5.54611566 -6.5771088 -4.51512254 0.0000000
## 3/15/2018-3/7/2018  -3.40847041 -4.6092589 -2.20768197 0.0000000
## 3/21/2018-3/7/2018  -4.20806614 -5.5437539 -2.87237833 0.0000000
## 3/22/2018-3/7/2018  -3.45577519 -4.6498610 -2.26168942 0.0000000
## 3/29/2018-3/7/2018  -4.46960785 -5.6703963 -3.26881941 0.0000000
## 3/21/2018-3/15/2018 -0.79959573 -1.9945859  0.39539441 0.4318976
## 3/22/2018-3/15/2018 -0.04730477 -1.0816066  0.98699708 0.9999995
## 3/29/2018-3/15/2018 -1.06113744 -2.1031703 -0.01910463 0.0427170
## 3/22/2018-3/21/2018  0.75229095 -0.4359638  1.94054571 0.5024870
## 3/29/2018-3/21/2018 -0.26154171 -1.4565318  0.93344842 0.9952607
## 3/29/2018-3/22/2018 -1.01383267 -2.0481345  0.02046919 0.0590118
ggplot(marchDaysCombined, aes(x = date, y = delay_minutes, fill = date)) +
geom_violin(show.legend = FALSE)+
geom_boxplot(width = .5, show.legend = FALSE)