-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRemoveOutliers_ServiceDesk.R
567 lines (459 loc) · 20.3 KB
/
RemoveOutliers_ServiceDesk.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
# Jung Mee Park
# August 6, 2021
# remove extreme outliers in R
# https://stackoverflow.com/questions/53201016/how-do-you-remove-outliers-in-r
#
# # return boxplot object
# durationMinutes = chat$ChatDuration/60
# b <- boxplot(durationMinutes, main = "Chat Duration", ylab = "Minutes")
#
# # find extremes from the boxplot's stats output
# lowerwhisker <- b$stats[1]
# upperwhisker <- b$stats[5]
#
# # remove the extremes
# chat <- chat[chat>lowerwhisker & chat<upperwhisker]
#
# # replot Chat data
# b<-boxplot(durationMinutes, main = "Chat Duration", ylab = "Minutes")
# also read https://www.r-bloggers.com/2012/06/whisker-of-boxplot/
# install.packages("patchwork")
library(patchwork)
library(ggpubr)
library(janitor)
# Part I filter out outliers
# outliers for Chat Duration
#filter outliers
outliers <- boxplot(chat$ChatDuration)$out
#drop the rows containing outliers
chatD_out <- chat[-c(which(chat$ChatDuration %in% outliers)),] # this did work
# chatD_out1 = dplyr::mutate(chatD_out, chatTime = filter1(chatD_out$CreatedDate))
# box plot of chat duration
durationMinutes1 <- chatD_out$ChatDuration/60
boxplot(durationMinutes1, main = "Chat Duration", ylab = "Minutes")
# filter outliers for the Wait time
# outliers1 <- boxplot(chat$WaitTime)$out
#drop the rows containing outliers
outliers1 <- boxplot(chat$WaitTime)$out
chat_wait_out <- chat[-c(which(chat$WaitTime %in% outliers1)),] # this did work
# for respondent wait time
waitMinutes1 = chat_wait_out$WaitTime/60
boxplot(waitMinutes1, main = "Respondent Wait Time", ylab = "Minutes")
# for abandoned chats
# filter outliers for the Abandoned
outliers2 <- boxplot(chat$Abandoned)$out
#drop the rows containing abandoned chat outliers
chatAb_out <- chat[-c(which(chat$Abandoned %in% outliers2)),] # this did work
boxplot(chatAb_out$Abandoned, main = "Abandoned Chats", ylab = "Seconds")
# for chat time of day, no outliers were dropped
# boxplot(filter(chat$CreatedDate), main = "Chat Time of Day", ylab = "Hour")
outliers3 <- boxplot(chat$tm1.dechr)$out
CreatedDate_out <- chat[-c(which(chat$tm1.dechr %in% outliers3)),]
# drop the rows containing outliers
boxplot(tm1.dechr, main = "Chat Time of Day", ylab = "Hour")
# Use subsetted data for further analysis
# for total chat duration
# chats1 = dplyr::mutate(chatD_out, durationHour = chatD_out$ChatDuration/60)
Chat_Dur_graph <- ggplot(chat, aes(x = LiveChatDeployment.DeveloperName, y = ChatDuration/60, fill = LiveChatDeployment.DeveloperName)) +
geom_boxplot() +
ylim(0, 35) +
ylab("Chat Time in Minutes") +
xlab("Unit Name")
Chat_Dur_graph <- Chat_Dur_graph + labs(title = "Unit Chat Duration",
subtitle = "outliers removed", fill = "Live Chat Developer")
print(Chat_Dur_graph)
# for total wait time
# chatD_out1 and waitMinutes1
waitMinutes1 = chat_wait_out$WaitTime/60
Wait_time_graph <- ggplot(chat_wait_out, aes(x = LiveChatDeployment.DeveloperName, y = waitMinutes1, fill = LiveChatDeployment.DeveloperName)) +
geom_boxplot() +
ylim(0, 4) +
ylab("Wait Time in Minutes") +
xlab("Unit Name")
Wait_time_graph <- Wait_time_graph + labs(title = "Unit Wait Time",
subtitle = "outliers removed", fill = "Live Chat Developer")
print(Wait_time_graph)
# # filter out Registrar and university services
# # yes, the data is filtered but does not fix the outlier problem
# chatD_out1a <- chatD_out1 %>%
# dplyr::filter(LiveChatDeployment.DeveloperName != "Registrar Chat") %>%
# dplyr::filter(LiveChatDeployment.DeveloperName != "University Services Chat") %>%
# dplyr::select(LiveChatDeployment.DeveloperName, WaitTime)
#
# # filter out more outliers
# outliers4 <- boxplot(chatD_out1a$WaitTime)$out
# chat_wait_out1 <- chatD_out1a[-c(which(chatD_out1a$WaitTime %in% outliers4)),] # this did not work
#
# # for respondent wait time
# waitMinutes1a = chatD_out1a$WaitTime/60
# Wait_time_graph2 <- ggplot(chatD_out1a, aes(x = LiveChatDeployment.DeveloperName, y = waitMinutes1a, fill = LiveChatDeployment.DeveloperName)) +
# geom_boxplot() +
# ylim(0, 180) +
# ylab("Wait Time in Minutes") +
# xlab("Unit Name")
#
# Wait_time_graph2 <- Wait_time_graph2 + labs(title = "Unit Wait Time",
# subtitle = "outliers removed", fill = "Live Chat Developer")
# print(Wait_time_graph2)
#
# Part II
# set theme
# theme_set(theme_gray())
# combined graph of boxplots
# par is for base R
# par(mfrow=c(2,2))
# boxplot without outliers
# boxplot of chat without outliers
# boxplot for chat duration
# durationMinutes1 = chatD_out$ChatDuration/60
# boxplot(durationMinutes1, main = "Chat Duration", ylab = "Minutes")
# overall chat duration without outliers
chatD_graph0 <- ggplot(chatD_out, aes(y = durationMinutes1)) +
geom_boxplot() +
ylim(0, 35) +
labs(x = "Overall", y="Minutes") +
scale_x_discrete(guide = guide_axis(n.dodge=2)) +
theme(legend.position="none")
chatD_graph0 <- chatD_graph0 + labs(title = "Chat Duration")
print(chatD_graph0)
# grouped by unit without outliers
chatD_graph <- ggplot(chatD_out, aes(x = LiveChatDeployment.DeveloperName, y = durationMinutes1, fill = LiveChatDeployment.DeveloperName)) +
geom_boxplot() +
ylim(0, 35) +
labs(x="Unit", y="Minutes") +
scale_x_discrete(guide = guide_axis(n.dodge=2))+
theme(legend.position="none")
chatD_graph <- chatD_graph + labs(title = "Chat Duration", subtitle = "outliers removed")
print(chatD_graph)
# full data for chat duration
chats = dplyr::mutate(chat, durationHour = chat$ChatDuration/60)
chatD_full <- ggplot(chats, aes(x = LiveChatDeployment.DeveloperName, y = waitMinutes, fill = LiveChatDeployment.DeveloperName)) +
geom_boxplot() +
labs(x="Unit", y="Minutes") +
scale_x_discrete(guide = guide_axis(n.dodge=2))+
theme(legend.position="none")
chatD_full <- chatD_full + labs(title = "Chat Duration", subtitle = "full data")
print(chatD_full)
# plot multiple graphs
chatD_both <- (chatD_full + chatD_graph) + # Create grid of plots with title
plot_annotation(title = "Comparing Full and Cleaned Data")
print(chatD_both)
### more with chat duration
# chatD_graph2 <- ggplot(chatD_out1, aes(x = LiveChatDeployment.DeveloperName,
# y = ChatDuration, fill = LiveChatDeployment.DeveloperName)) +
# geom_bar(stat = 'identity') +
# labs(x="Unit", y="seconds") +
# scale_x_discrete(guide = guide_axis(n.dodge=2))+
# theme(legend.position="none")
#
# chatD_graph2 <- chatD_graph2 + labs(title = "Chat Duration", subtitle = "outliers removed")
# print(chatD_graph2)
# boxplot for wait time outliers removed
# waitMinutes1 = chat_wait_out$WaitTime/60
# boxplot(waitMinutes1, main = "Respondent Wait Time", ylab = "Minutes")
Wait_time_graph2a <- ggplot(chat_wait_out, aes(y = waitMinutes1)) +
geom_boxplot() +
ylim(0, 5) +
labs(x="Overall", y="Minutes") +
scale_x_discrete(guide = guide_axis(n.dodge=2))+
theme(legend.position="none")
Wait_time_graph2a <- Wait_time_graph2a + labs(title = "Wait Time")
print(Wait_time_graph2a)
# grouped by unit
Wait_time_graph2 <- ggplot(chat_wait_out, aes(x = LiveChatDeployment.DeveloperName, y = waitMinutes1, fill = LiveChatDeployment.DeveloperName)) +
geom_boxplot() +
ylim(0, 5) +
labs(x="Unit", y="Minutes") +
scale_x_discrete(guide = guide_axis(n.dodge=2)) +
theme(legend.position="none")
Wait_time_graph2 <- Wait_time_graph2 + labs(title = "Wait Time", subtitle = "outliers removed")
print(Wait_time_graph2)
# full data wait time
Wait_time_graph1 <- ggplot(chat, aes(x = LiveChatDeployment.DeveloperName, y = waitMinutes, fill = LiveChatDeployment.DeveloperName)) +
geom_boxplot() +
# ylim(0, 5) +
labs(x="Unit", y="Minutes") +
scale_x_discrete(guide = guide_axis(n.dodge=2))+
theme(legend.position="none")
Wait_time_graph1 <- Wait_time_graph1 + labs(title = "Wait Time", subtitle = "full data")
print(Wait_time_graph1)
# plot multiple wait time graphs
Wait_time_both <- (Wait_time_graph1 + Wait_time_graph2) + # Create grid of plots with title
plot_annotation(title = "Comparing Full and Cleaned Data")
print(Wait_time_both)
# boxplot for abandoned chats
# boxplot(chatAb_out$Abandoned, main = "Abandoned Chats", ylab = "Numbers of chat")
Chat_ab_graph0 <- ggplot(chatAb_out, aes(y = Abandoned/60)) +
geom_boxplot() +
# ylim(0, 800) +
labs(x="Overall", y="Minutes") +
scale_x_discrete(guide = guide_axis(n.dodge=2))+
theme(legend.position="none")
Chat_ab_graph0 <- Chat_ab_graph0 + labs(title = "Abandoned Chats")
print(Chat_ab_graph0)
# grouped by unit
Chat_ab_graph <- ggplot(chatAb_out, aes(x = LiveChatDeployment.DeveloperName, y = Abandoned/60, fill = LiveChatDeployment.DeveloperName)) +
geom_boxplot() +
# ylim(0, 800) +
labs(x="Unit", y="Minutes") +
scale_x_discrete(guide = guide_axis(n.dodge=2))+
theme(legend.position="none")
Chat_ab_graph <- Chat_ab_graph + labs(title = "Abandoned Chats", subtitle = "outliers removed")
print(Chat_ab_graph)
# full data for abandoned chats grouped by unit
Chat_ab_full <- ggplot(chat, aes(x = LiveChatDeployment.DeveloperName, y = Abandoned/60, fill = LiveChatDeployment.DeveloperName)) +
geom_boxplot() +
# ylim(0, 800) +
labs(x="Unit", y="Minutes") +
scale_x_discrete(guide = guide_axis(n.dodge=2))+
theme(legend.position="none")
Chat_ab_full <- Chat_ab_full + labs(title = "Abandoned Chats", subtitle = "full data")
print(Chat_ab_full)
# plot multiple abandon graphs
Chat_ab_both <- (Chat_ab_full + Chat_ab_graph) + # Create grid of plots with title
plot_annotation(title = "Comparing Full and Cleaned Data")
print(Chat_ab_both)
# boxplot for chat time of day outliers removed
# boxplot(filter1(chat$CreatedDate), main = "Chat Time of Day", ylab = "Hour")
# created_hour <- filter1(CreatedDate_out$AZ_time)
CreatedDate_graph0 <- ggplot(CreatedDate_out, aes(y = tm1.dechr)) +
geom_boxplot() +
# ylim(0, 24) +
labs(x="Overall", y="Hour") +
scale_x_discrete(guide = guide_axis(n.dodge=2))+
theme(legend.position="none")
CreatedDate_graph0 <- CreatedDate_graph0 + labs(title = "Chat Time of Day") +
scale_y_continuous(breaks=seq(0,24,4))
print(CreatedDate_graph0)
# grouped by unit
# created_hour <- filter1(CreatedDate_out$CreatedDate)
CreatedDate_graph <- ggplot(CreatedDate_out, aes(x = LiveChatDeployment.DeveloperName, y = tm1.dechr,
fill = LiveChatDeployment.DeveloperName)) +
geom_boxplot() +
ylim(0, 24) +
labs(x="Unit", y="Hour") +
scale_x_discrete(guide = guide_axis(n.dodge=2))+
theme(legend.position="none")
CreatedDate_graph <- CreatedDate_graph + labs(title = "Chat Time of Day", subtitle = "outliers removed") +
scale_y_continuous(breaks=seq(0,24,4), limits = c(0,24))
print(CreatedDate_graph)
# with full data for chat time of day
# chats = dplyr::mutate(chat, chatTime = filter1(chat$CreatedDate))
#
Unit_ToD <- ggplot(chat, aes(x = LiveChatDeployment.DeveloperName,
y = tm1.dechr, fill = LiveChatDeployment.DeveloperName)) +
geom_boxplot() +
# ggtitle("Unit Chat Time of Day") +
# ylim(0, 24) +
ylab("Hour") +
xlab("Unit") +
scale_x_discrete(guide = guide_axis(n.dodge=2)) +
theme(legend.position="none")
Unit_ToD <- Unit_ToD + labs(title = "Chat Time of Day",
subtitle = "full data") +
scale_y_continuous(breaks=seq(0,24,2))
print(Unit_ToD)
# multiple plot of ToD with and without the outliers
# plot both Time of Day graphs
ToD_both <- (Unit_ToD + CreatedDate_graph) + # Create grid of plots with title
plot_annotation(title = "Comparing Full and Cleaned Data")
print(ToD_both)
# Part III combined graphs
# plot multiple graphs with the overview of service chat
ggp_all <- (chatD_graph0 + Wait_time_graph2a) / (Chat_ab_graph0 + CreatedDate_graph0) + # Create grid of plots with title
plot_annotation(title = "Overview of Service Desk Requests via Chat", subtitle = "outliers removed")
ggp_all
# grouped by units
# redo all graphs
# redo chat duration
chatD_graph1 <- ggplot(chatD_out, aes(x = LiveChatDeployment.DeveloperName, y = durationMinutes1, fill = LiveChatDeployment.DeveloperName)) +
geom_boxplot() +
ylim(0, 35) +
labs(x="Unit", y="Minutes") +
scale_x_discrete(guide = guide_axis(n.dodge=2))+
theme(legend.position="none")
chatD_graph1 <- chatD_graph1 + labs(title = "Chat Duration")
print(chatD_graph1)
# redo abandoned data
Wait_time_graph2b <- ggplot(chat_wait_out, aes(x = LiveChatDeployment.DeveloperName, y = waitMinutes1, fill = LiveChatDeployment.DeveloperName)) +
geom_boxplot() +
ylim(0, 5) +
labs(x="Unit", y="Minutes") +
scale_x_discrete(guide = guide_axis(n.dodge=2)) +
theme(legend.position="none")
Wait_time_graph2b <- Wait_time_graph2b + labs(title = "Wait Time")
print(Wait_time_graph2b)
# redo abandoned chat
Chat_ab_graph1 <- ggplot(chatAb_out, aes(x = LiveChatDeployment.DeveloperName, y = Abandoned/60, fill = LiveChatDeployment.DeveloperName)) +
geom_boxplot() +
# ylim(0, 800) +
labs(x="Unit", y="Minutes") +
scale_x_discrete(guide = guide_axis(n.dodge=2))+
theme(legend.position="none")
Chat_ab_graph1 <- Chat_ab_graph1 + labs(title = "Abandoned Chats")
print(Chat_ab_graph1)
# redo the Time of Day time scale
CreatedDate_graph1 <- ggplot(CreatedDate_out, aes(x = LiveChatDeployment.DeveloperName, y = tm1.dechr,
fill = LiveChatDeployment.DeveloperName)) +
geom_boxplot() +
ylim(0, 24) +
labs(x="Unit", y="Hour") +
scale_x_discrete(guide = guide_axis(n.dodge=2))+
theme(legend.position="none")
CreatedDate_graph1 <- CreatedDate_graph1 + labs(title = "Chat Time of Day") +
scale_y_continuous(breaks=seq(0,24,4))
print(CreatedDate_graph1)
# combine it into a graph
ggp_unit <- (chatD_graph1 + Wait_time_graph2b) / (Chat_ab_graph1 + CreatedDate_graph1) + # Create grid of plots with title
plot_annotation(title = "Overview of Service Desk Requests via Chat", subtitle = "outliers removed")
ggp_unit
##Table for Time of Day
CreatedDate_out %>%
group_by(LiveChatDeployment.DeveloperName) %>%
dplyr::summarise(Ave_hour1 = mean(tm1.dechr, na.rm = TRUE))
# new graph for time of day and day of the week
DoW_graph1 <- ggplot(chat, aes(x = day_of_the_week, y = tm1.dechr,
fill = day_of_the_week)) +
geom_boxplot() +
ylim(0, 24) +
labs(x="Day of the Week", y="Hour") +
scale_x_discrete(guide = guide_axis(n.dodge=2))+
theme(legend.position="none")
DoW_graph1 <- DoW_graph1 + labs(title = "Chat Time of Day", subtitle = "full data") +
scale_y_continuous(breaks=seq(0,24,4))
print(DoW_graph1)
# DoW graph with outliers removed
DoW_graph <- ggplot(CreatedDate_out, aes(x = day_of_the_week, y = tm1.dechr,
fill = day_of_the_week)) +
geom_boxplot() +
ylim(0, 24) +
labs(x="Day of the Week", y="Hour") +
scale_x_discrete(guide = guide_axis(n.dodge=2))+
theme(legend.position="none")
DoW_graph <- DoW_graph + labs(title = "Chat Time of Day", subtitle = "outliers removed") +
scale_y_continuous(breaks=seq(0,24,4), limits = c(0,24))
print(DoW_graph)
# print both on the same chart
DoW_both <- (DoW_graph1 + DoW_graph) + # Create grid of plots with title
plot_annotation(title = "Comparing Full and Cleaned Data")
print(DoW_both)
# #### try another look
# DoW_graph2 <- ggplot(chat, aes(x=day_of_the_week, y=tm1.dechr)) +
# geom_bar(aes(y = tm1.dechr, colour = "day_of_the_weekr")) +
# # geom_smooth() +
# # geom_point(aes(y = LiveChatDeployment.DeveloperName, colour = "LiveChatDeployment.DeveloperName")) +
# # geom_smooth()+
# ylab("Hour") +
# xlab("") +
# scale_color_discrete(name="", labels=c("", ""))
#
# DoW_graph2 <- DoW_graph2 + labs(title = "Time of Chat Requests Timed Out based on Time of Day",
# subtitle="full data", fill = "Time") +
# scale_y_continuous(breaks=seq(0,24,2))
#
# DoW_graph2
### Graph with counts and percentages with adjusted labels
DoW_3 <- chat %>%
group_by(day_of_the_week) %>%
summarize(count = n()) %>% # count records by species
mutate(pct = round(count/sum(count), 3))
DoW_graph3 <-
ggplot(DoW_3, aes(day_of_the_week,
count, fill = day_of_the_week)) +
geom_bar(stat='identity') +
labs(x = "Day of the Week", y = "Number of Chats") +
theme(legend.position="none") +
geom_text(aes(label = (scales::percent(pct)), y = if_else(count > 0.1*max(count), count/2, count+ 0.05*max(count))))
DoW_graph3 <- DoW_graph3+ labs(title = "Number of Chats per Days",
subtitle = "full data", fill = "Live Chat Developer")
print(DoW_graph3)
###
# DoW_4 <- chat %>%
# group_by(day_of_the_week) %>%
# summarize(count = n()) # count records by species
# # mutate(pct = count/sum(count))
# DoW_graph4 <-
# ggplot(chat, aes(x = day_of_the_week,
# y = count, fill = LiveChatDeployment.DeveloperName)) +
# geom_bar(stat='identity') +
# labs(x = "Day of the Week", y = "Number of Chats") +
# theme(legend.position="none") +
# geom_text(aes(label = scales::percent(pct), y = if_else(count > 0.1*max(count), count/2, count+ 0.05*max(count))))
#
# DoW_graph4 <- DoW_graph4 + labs(title = "Number of Chats per Days",
# subtitle = "full data", fill = "Live Chat Developer")
#
# print(DoW_graph4)
#
DoW_5 <- chat %>%
group_by(LiveChatDeployment.DeveloperName) %>%
summarize(count = n())
DoW_graph5 <- chat %>%
pivot_longer(day_of_the_week, names_to = "question", values_to = "response",
values_drop_na = TRUE) %>%
ggplot(aes(x = response, fill = LiveChatDeployment.DeveloperName)) +
geom_bar() +
# geom_text(aes(label = stat(),
# group = day_of_the_week), stat = 'summary', fun = sum, vjust = -1) +
# geom_text(stat = 'count', aes(label = ..count..) +
labs(x = "", y = "")
DoW_graph5 <- DoW_graph5 + labs(title = "Chat Deployment by Day of the Week",
subtitle = "full data", fill = "Live Chat Developer")
print(DoW_graph5)
# Add summary labels to graph Total Sandbox
DoW_7 <- chat %>%
select("day_of_the_week", "LiveChatDeployment.DeveloperName")
DoW_graph7 <- chat %>%
# pivot_longer(day_of_the_week, names_to = "question", values_to = "response",
# values_drop_na = TRUE) %>%
ggplot(aes(x = day_of_the_week, y= LiveChatDeployment.DeveloperName, fill = LiveChatDeployment.DeveloperName)) +
# ggplot(aes(x = day_of_the_week, y=count, fill = LiveChatDeployment.DeveloperName)) +
# geom_col(aes(fill = LiveChatDeployment.DeveloperName), position = "dodge")
# geom_bar(stat = "identity") +
geom_col() +
# geom_text(stat = 'count', aes(label=c(706,4148,3319,3329,3400,2799,668)))
# geom_text(aes(label=c(706,4148,3319,3329,3400,2799,668)))
geom_text(aes(label=LiveChatDeployment.DeveloperName))
# #
DoW_graph7
# adjust for each division
# DoW graph with outliers removed
DoW_graph6 <- chat %>%
dplyr::filter(LiveChatDeployment.DeveloperName == "OSFA Chat") %>%
pivot_longer(day_of_the_week, names_to = "question", values_to = "response",
values_drop_na = TRUE) %>%
ggplot(aes(x = response, fill = LiveChatDeployment.DeveloperName)) +
geom_bar() +
# geom_text(stat='count', aes(label=..count..)) +
geom_boxplot() +
labs(x = "", y = "") +
theme(legend.position="none")
DoW_graph6 <- DoW_graph6 + labs(title = "Chat Deployment by Day of the Week",
subtitle = "OFSA only", fill = "Live Chat Developer")
print(DoW_graph6)
##
DoW_graph7 <- chat %>%
dplyr::filter(LiveChatDeployment.DeveloperName == "24/7 Chat") %>%
pivot_longer(day_of_the_week, names_to = "question", values_to = "response",
values_drop_na = TRUE) %>%
ggplot(aes(x = response, fill = LiveChatDeployment.DeveloperName)) +
geom_bar() +
# geom_text(stat='count', aes(label=..count..)) +
geom_boxplot() +
labs(x = "", y = "") +
theme(legend.position="none")
DoW_graph7 <- DoW_graph7 + labs(title = "Chat Deployment by Day of the Week",
subtitle = "24/7 only", fill = "Live Chat Developer")
print(DoW_graph7)
# ##
# DoW_graph8 <- chat %>%
# ggplot(aes(x = Location, y = tm1.dechr, fill = tm1.dechr)) +
# geom_point() +
# # geom_text(stat='count', aes(label=..count..)) +
# geom_boxplot() +
# labs(x = "", y = "") +
# theme(legend.position="none")
#
# DoW_graph8 <- DoW_graph8 + labs(title = "Chat Deployment by Day of the Week",
# subtitle = "", fill = "Live Chat Developer")
#