-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
512 lines (512 loc) · 34.8 KB
/
.Rhistory
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
hist(csat$CLAGENT)
library(gridExtra)
library(ggplot2) # ggplot2 for creating the charts
library(scales) # scales for the dollar formatting of the axis.
library(gridExtra)
csat <- read.csv("C:/Users/jgreen/Documents/R_Files/CSAT_COGS.csv")
set.seed(10005)
xvar <- c(rnorm(1500, mean = -1), rnorm(1500, mean = 1.5))
yvar <- c(rnorm(1500, mean = 1), rnorm(1500, mean = 1.5))
zvar <- as.factor(c(rep(1, 1500), rep(2, 1500)))
xy <- data.frame(xvar, yvar, zvar)
#counts on y-axis
g1<-ggplot(xy, aes(xvar)) + geom_histogram() #horribly ugly default
g2<-ggplot(xy, aes(xvar)) + geom_histogram(binwidth=1) #change binwidth
g3<-ggplot(xy, aes(xvar)) + geom_histogram(fill=NA, color="black") + theme_bw() #nicer looking
#density on y-axis
g4<-ggplot(xy, aes(x=xvar)) + geom_histogram(aes(y = ..density..), color="black", fill=NA) + theme_bw()
grid.arrange(g1, g2, g3, g4, nrow=1)
ggplot(csat, aes(CLAGENT)) + geom_histogram()
ggplot(csat, aes(factor(CLAGENT)) + geom_histogram()
ggplot(csat, aes(factor(CLAGENT))) + geom_histogram()
set.seed(10005)
ggplot(csat, aes(factor(CLAGENT))) + geom_histogram()
countsByCOGSBin <- ggplot(csat, aes(COGS)) + geom_histogram()
countsByCOGSBin
countsByCOGSBin <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=20)
countsByCOGSBin <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=100)
ggplot(csat, aes(COGS)) + geom_histogram(binwidth=20)
ggplot(csat, aes(COGS)) + geom_histogram(binwidth=50)
qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot")
ggplot(xy, aes(x = xvar)) +
stat_density(aes(ymax = ..density.., ymin = -..density..,
fill = zvar, color = zvar),
geom = "ribbon", position = "identity") +
facet_grid(. ~ zvar) +
coord_flip() +
theme(legend.position = "none")
ggplot(csat, aes(COGS)) + geom_histogram(binwidth=50)
ggplot(csat, aes(COGS)) + geom_histogram(binwidth=50, fill=NA, color="black") + theme_bw()
ggplot(csat, aes(COGS)) + geom_histogram(binwidth=50, fill=blue, color="black") + theme_bw()
ggplot(csat, aes(COGS)) + geom_histogram(binwidth=50, fill="blue", color="black") + theme_bw()
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram()
countByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=50, fill="blue", color="black") + theme_bw()
grid.arrange(countByScore, countByCOGS, g3, g4, nrow=1)
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=50, fill="blue", color="black") + theme_bw()
grid.arrange(countsByScore, countsByCOGS, g3, g4, nrow=1)
grid.arrange(countsByScore, countsByCOGS, nrow=1)
qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot")
grid.arrange(countsByScore, countsByCOGS, COGSBoxesByScore, nrow=2)
COGSBoxesByScore <- qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot")
grid.arrange(countsByScore, countsByCOGS, COGSBoxesByScore, nrow=2)
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=20, fill="blue", color="black") + theme_bw()
COGSBoxesByScore <- qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot")
grid.arrange(countsByScore, countsByCOGS, COGSBoxesByScore, nrow=2)
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=30, fill="blue", color="black") + theme_bw()
COGSBoxesByScore <- qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot")
grid.arrange(countsByScore, countsByCOGS, COGSBoxesByScore, nrow=2)
qplot(COGS, CLAGENT, data=csat, geom="boxplot")
ggplot(csat, aes(factor(CLAGENT))) + geom_histogram() + geom_jitter()
qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") + geom_jitter()
qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot")
qplot(cut(COGS, seq(0,700,50)), CLAGENT, data=csat, geom="boxplot")
qplot(cut(COGS, seq(0,700,20)), CLAGENT, data=csat, geom="boxplot")
qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot")
qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
ggplot(csat, aes(cut(COGS, seq(0,700,30)), CLAGENT)) + geom_boxplot(outlier.color = "gray")
ggplot(csat, aes(cut(COGS, seq(0,700,30)), CLAGENT)) + geom_boxplot(outlier.color = "green")
ggplot(csat, aes(cut(COGS, seq(0,700,30)), CLAGENT)) + geom_boxplot(outlier.colour = "green")
ggplot(csat, aes(cut(COGS, seq(0,700,30)), CLAGENT)) + geom_boxplot(outlier.colour = "red")
ggplot(csat, aes(cut(COGS, seq(0,700,30)), CLAGENT)) + geom_boxplot(outlier.colour = "gray")
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=30, fill="blue", color="black") + theme_bw()
COGSBoxesByScore <- qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") + geom_jitter()
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,700,30)), CLAGENT)) + geom_boxplot(outlier.colour = "gray")
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
grid.arrange(countsByScore, countsByCOGS, COGSBoxesByScore, ScoreBoxesByCOGS, nrow=2)
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=30, fill="blue", color="black") + theme_bw()
COGSBoxesByScore <- qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") #+ geom_jitter()
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,700,30)), CLAGENT)) + geom_boxplot(outlier.colour = "gray")
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
grid.arrange(countsByScore, countsByCOGS, COGSBoxesByScore, ScoreBoxesByCOGS, nrow=2)
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=30, fill="blue", color="black") + theme_bw()
COGSBoxesByScore <- qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") #+ geom_jitter()
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,400,30)), CLAGENT)) + geom_boxplot(outlier.colour = "gray")
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
grid.arrange(countsByScore, countsByCOGS, COGSBoxesByScore, ScoreBoxesByCOGS, nrow=2)
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=30, fill="blue", color="black") + theme_bw()
COGSBoxesByScore <- qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") #+ geom_jitter()
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,700,30)), CLAGENT)) + geom_boxplot(outlier.colour = "gray")
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
grid.arrange(countsByScore, countsByCOGS, COGSBoxesByScore, ScoreBoxesByCOGS, nrow=2)
with(csat, plot(CLAGENT, COGS))
ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot
COGSBoxesByScore <- ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot()
ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot()
ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_jitter()
ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_point()
ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_jitter()
csat$goodScore[csat$CLAGENT >= 9] <- "Y"
csat$goodScore[csat$CLAGENT < 9] <- "N"
ggplot(csat, aes(goodScore,COGS)) + geom_boxplot()
ggplot(csat, aes(goodScore)) + geom_histogram()
ScoreBoxes <- ggplot(csat, aes(goodScore,COGS)) + geom_boxplot()
ScoreCounts <- ggplot(csat, aes(goodScore)) + geom_histogram()
grid.arrange(ScoreCounts, ScoreBoxes, nrow=2)
ggplot(csat, aes(goodScore)) + geom_histogram() +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
ggplot(csat, aes(goodScore,COGS)) + geom_boxplot() +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot() +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
ggplot(csat, aes(cut(COGS, seq(0,700,30)), CLAGENT)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=30, fill="blue", color="black") + theme_bw()
COGSBoxesByScore <- ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot() +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
#qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") #+ geom_jitter()
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,700,30)), CLAGENT)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
ScoreBoxes <- ggplot(csat, aes(goodScore,COGS)) + geom_boxplot() +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
ScoreCounts <- ggplot(csat, aes(goodScore)) + geom_histogram()
grid.arrange(countsByScore, countsByCOGS, COGSBoxesByScore, ScoreBoxesByCOGS, ScoreCounts, ScoreBoxes, nrow=2)
grid.arrange(countsByScore, ScoreCounts, countsByCOGS, COGSBoxesByScore, ScoreBoxes, ScoreBoxesByCOGS, nrow=2)
names(csat)
csat
csat <- subset(csat, RESPONSE_DATE >= '2013-01-01')
csat$RESPONSE_DATE <- as.Date(csat$RESPONSE_DATE)
csat <- subset(csat, RESPONSE_DATE >= '2013-01-01')
csat
csat <- read.csv("C:/Users/jgreen/Documents/R_Files/CSAT_COGS.csv")
csat$goodScore <- subset(csat, CLAGENT >= 9)
csat$goodScore[csat$CLAGENT >= 9] <- "Y"
csat$goodScore[csat$CLAGENT < 9] <- "N"
csat
csat$RESPONSE_DATE <- as.Date(csat$RESPONSE_DATE)
ggplot(csat, aes(goodScore,COGS)) + geom_boxplot() +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=30, fill="blue", color="black") + theme_bw()
COGSBoxesByScore <- ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
#qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") #+ geom_jitter()
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,700,30)), CLAGENT)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
ScoreBoxes <- ggplot(csat, aes(goodScore,COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
ScoreCounts <- ggplot(csat, aes(goodScore)) + geom_histogram()
grid.arrange(countsByScore, ScoreCounts, countsByCOGS, COGSBoxesByScore, ScoreBoxes, ScoreBoxesByCOGS, nrow=2)
ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='line',size = 3, color='red')
grid.arrange(countsByScore, ScoreCounts, countsByCOGS, COGSBoxesByScore, ScoreBoxes, ScoreBoxesByCOGS, nrow=2)
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram(fill="gray")
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=30, fill="gray", color="black") + theme_bw()
COGSBoxesByScore <- ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
#qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") #+ geom_jitter()
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,700,30)), CLAGENT)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
ScoreBoxes <- ggplot(csat, aes(goodScore,COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
ScoreCounts <- ggplot(csat, aes(goodScore)) + geom_histogram(fill="gray")
grid.arrange(countsByScore, ScoreCounts, countsByCOGS, COGSBoxesByScore, ScoreBoxes, ScoreBoxesByCOGS, nrow=2)
#####################################
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram(fill="gray") theme_bw()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=30, fill="gray", color="black") + theme_bw()
COGSBoxesByScore <- ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
#qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") #+ geom_jitter()
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,700,30)), CLAGENT)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
ScoreBoxes <- ggplot(csat, aes(goodScore,COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
ScoreCounts <- ggplot(csat, aes(goodScore)) + geom_histogram(fill="gray") theme_bw()
grid.arrange(countsByScore, ScoreCounts, countsByCOGS, COGSBoxesByScore, ScoreBoxes, ScoreBoxesByCOGS, nrow=2)
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram(fill="gray", color="black") theme_bw()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=30, fill="gray", color="black") + theme_bw()
COGSBoxesByScore <- ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
#qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") #+ geom_jitter()
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,700,30)), CLAGENT)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
ScoreBoxes <- ggplot(csat, aes(goodScore,COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
ScoreCounts <- ggplot(csat, aes(goodScore)) + geom_histogram(fill="gray", color="black") theme_bw()
grid.arrange(countsByScore, ScoreCounts, countsByCOGS, COGSBoxesByScore, ScoreBoxes, ScoreBoxesByCOGS, nrow=2)
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram(fill="gray", color="black") + theme_bw()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=30, fill="gray", color="black") + theme_bw()
COGSBoxesByScore <- ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
#qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") #+ geom_jitter()
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,700,30)), CLAGENT)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
ScoreBoxes <- ggplot(csat, aes(goodScore,COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red')
ScoreCounts <- ggplot(csat, aes(goodScore)) + geom_histogram(fill="gray", color="black") + theme_bw()
grid.arrange(countsByScore, ScoreCounts, countsByCOGS, COGSBoxesByScore, ScoreBoxes, ScoreBoxesByCOGS, nrow=2)
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram(fill="gray", color="black") + theme_bw()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=30, fill="gray", color="black") + theme_bw()
COGSBoxesByScore <- ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") #+ geom_jitter()
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,700,30)), CLAGENT)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
ScoreBoxes <- ggplot(csat, aes(goodScore,COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
ScoreCounts <- ggplot(csat, aes(goodScore)) + geom_histogram(fill="gray", color="black") + theme_bw()
grid.arrange(countsByScore, ScoreCounts, countsByCOGS, COGSBoxesByScore, ScoreBoxes, ScoreBoxesByCOGS, nrow=2)
ggplot(csat, aes(COGS)) + geom_histogram(binwidth=30, fill=goodScore, color="black") + theme_bw()
ggplot(csat, aes(COGS)) + geom_histogram(binwidth=30, fill=csat$goodScore, color="black") + theme_bw()
ggplot(csat, aes(COGS)) + geom_histogram(binwidth=30, fill=factor(csat$goodScore), color="black") + theme_bw()
grid.arrange(countsByScore, ScoreCounts, countsByCOGS, COGSBoxesByScore, ScoreBoxes, ScoreBoxesByCOGS, nrow=2)
csat$RESPONSE_DATE <- as.Date(as.character(csat$RESPONSE_DATE), "%m/%D/%Y")
csat <- subset(csat, RESPONSE_DATE >= '01/01/2013')
csat
csat$RESPONSE_DATE
csat <- read.csv("C:/Users/jgreen/Documents/R_Files/CSAT_COGS.csv")
csat$goodScore <- subset(csat, CLAGENT >= 9)
csat$goodScore[csat$CLAGENT >= 9] <- "Y"
csat$goodScore[csat$CLAGENT < 9] <- "N"
csat$RESPONSE_DATE <- as.Date(as.character(csat$RESPONSE_DATE), "%m/%D/%Y")
csat$RESPONSE_DATE
csat <- read.csv("C:/Users/jgreen/Documents/R_Files/CSAT_COGS.csv")
csat$goodScore <- subset(csat, CLAGENT >= 9)
csat$goodScore[csat$CLAGENT >= 9] <- "Y"
csat$goodScore[csat$CLAGENT < 9] <- "N"
csat$RESPONSE_DATE <- as.Date(csat$RESPONSE_DATE, "%m/%D/%Y")
csat$RESPONSE_DATE
csat <- read.csv("C:/Users/jgreen/Documents/R_Files/CSAT_COGS.csv")
csat$goodScore <- subset(csat, CLAGENT >= 9)
csat$goodScore[csat$CLAGENT >= 9] <- "Y"
csat$goodScore[csat$CLAGENT < 9] <- "N"
csat$RESPONSE_DATE
csat <- subset(csat, RESPONSE_DATE >= '01/01/2013')
as.Date(csat$RESPONSE_DATE, format="%m/%D/%Y")
csat$RESPONSE_DATE
as.Date(as.character(csat$RESPONSE_DATE), format="%m/%D/%Y")
csat <- read.csv("C:/Users/jgreen/Documents/R_Files/CSAT_COGS.csv")
csat$goodScore <- subset(csat, CLAGENT >= 9)
csat$goodScore[csat$CLAGENT >= 9] <- "Y"
csat$goodScore[csat$CLAGENT < 9] <- "N"
as.Date(as.character(csat$RESPONSE_DATE), format="%m/%D/%Y")
as.Date(csat$RESPONSE_DATE, format="%m/%D/%Y")
as.Date(csat$RESPONSE_DATE, format="%Y")
as.Date(csat$RESPONSE_DATE, format="%Y-%M-%d")
as.Date(csat$RESPONSE_DATE, format="%Y-%M-%D")
as.Date(csat$RESPONSE_DATE, format="%YYYY-%mm-%dd")
as.Date(csat$RESPONSE_DATE, format="%Y-%m-%d")
as.Date(csat$RESPONSE_DATE, format="%Y %m %d")
as.Date(csat$RESPONSE_DATE, format="%m/%d/%Y")
csat$RESPONSE_DATE <- as.Date(csat$RESPONSE_DATE, format="%m/%d/%Y")
csat <- subset(csat, RESPONSE_DATE >= '01/01/2013')
csat
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram(fill="gray", color="black") + theme_bw()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=30, fill="gray", color="black") + theme_bw()
COGSBoxesByScore <- ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") #+ geom_jitter()
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,700,30)), CLAGENT)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
ScoreBoxes <- ggplot(csat, aes(goodScore,COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
ScoreCounts <- ggplot(csat, aes(goodScore)) + geom_histogram(fill="gray", color="black") + theme_bw()
grid.arrange(countsByScore, ScoreCounts, countsByCOGS, COGSBoxesByScore, ScoreBoxes, ScoreBoxesByCOGS, nrow=2)
csat <- subset(csat, RESPONSE_DATE >= '12/01/2013')
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram(fill="gray", color="black") + theme_bw()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=30, fill="gray", color="black") + theme_bw()
COGSBoxesByScore <- ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") #+ geom_jitter()
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,700,30)), CLAGENT)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
ScoreBoxes <- ggplot(csat, aes(goodScore,COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
ScoreCounts <- ggplot(csat, aes(goodScore)) + geom_histogram(fill="gray", color="black") + theme_bw()
grid.arrange(countsByScore, ScoreCounts, countsByCOGS, COGSBoxesByScore, ScoreBoxes, ScoreBoxesByCOGS, nrow=2)
#####################################
csat
csat$RESPONSE_DATE
csat <- subset(csat, RESPONSE_DATE >= '2013-10-01')
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram(fill="gray", color="black") + theme_bw()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=30, fill="gray", color="black") + theme_bw()
COGSBoxesByScore <- ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") #+ geom_jitter()
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,700,30)), CLAGENT)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
ScoreBoxes <- ggplot(csat, aes(goodScore,COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
ScoreCounts <- ggplot(csat, aes(goodScore)) + geom_histogram(fill="gray", color="black") + theme_bw()
grid.arrange(countsByScore, ScoreCounts, countsByCOGS, COGSBoxesByScore, ScoreBoxes, ScoreBoxesByCOGS, nrow=2)
csat <- subset(csat, RESPONSE_DATE >= '2013-12-01')
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram(fill="gray", color="black") + theme_bw()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=30, fill="gray", color="black") + theme_bw()
COGSBoxesByScore <- ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") #+ geom_jitter()
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,700,30)), CLAGENT)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
ScoreBoxes <- ggplot(csat, aes(goodScore,COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
ScoreCounts <- ggplot(csat, aes(goodScore)) + geom_histogram(fill="gray", color="black") + theme_bw()
grid.arrange(countsByScore, ScoreCounts, countsByCOGS, COGSBoxesByScore, ScoreBoxes, ScoreBoxesByCOGS, nrow=2)
#####################################
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,700,100)), CLAGENT)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
ScoreBoxes <- ggplot(csat, aes(goodScore,COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
ScoreCounts <- ggplot(csat, aes(goodScore)) + geom_histogram(fill="gray", color="black") + theme_bw()
grid.arrange(countsByScore, ScoreCounts, countsByCOGS, COGSBoxesByScore, ScoreBoxes, ScoreBoxesByCOGS, nrow=2)
#####################################
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,700,50)), CLAGENT)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
ScoreBoxes <- ggplot(csat, aes(goodScore,COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
ScoreCounts <- ggplot(csat, aes(goodScore)) + geom_histogram(fill="gray", color="black") + theme_bw()
grid.arrange(countsByScore, ScoreCounts, countsByCOGS, COGSBoxesByScore, ScoreBoxes, ScoreBoxesByCOGS, nrow=2)
#####################################
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=50, fill="gray", color="black") + theme_bw()
COGSBoxesByScore <- ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") #+ geom_jitter()
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,700,50)), CLAGENT)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
ScoreBoxes <- ggplot(csat, aes(goodScore,COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
ScoreCounts <- ggplot(csat, aes(goodScore)) + geom_histogram(fill="gray", color="black") + theme_bw()
grid.arrange(countsByScore, ScoreCounts, countsByCOGS, COGSBoxesByScore, ScoreBoxes, ScoreBoxesByCOGS, nrow=2)
#####################################
ggplot(csat, aes(goodScore)) + geom_histogram(aes(y = ..density..), fill="gray", color="black") + theme_bw()
ggplot(csat, aes(goodScore)) + geom_density()
ggplot(csat, aes(goodScore)) + geom_histogram(aes(y = ..density..), fill="gray", color="black") + theme_bw() + geom_density()
ggplot(csat, aes(goodScore)) + geom_histogram(fill="gray", color="black") + theme_bw() + geom_density()
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram(fill="gray", color="black") + theme_bw()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=50, fill="gray", color="black") + theme_bw()
COGSBoxesByScore <- ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") #+ geom_jitter()
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,700,50)), CLAGENT)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
ScoreBoxes <- ggplot(csat, aes(goodScore,COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
ScoreCounts <- ggplot(csat, aes(goodScore)) + geom_histogram(fill="gray", color="black") + theme_bw()
grid.arrange(countsByScore, ScoreCounts, countsByCOGS, COGSBoxesByScore, ScoreBoxes, ScoreBoxesByCOGS, nrow=2)
#####################################
#install.packages("ggplot2") # Install GGPlot2 *Only needed if not already installed.
library(ggplot2) # ggplot2 for creating the charts
library(scales) # scales for the dollar formatting of the axis.
library(gridExtra)
#Load the csv file containing the values:
csat <- read.csv("C:/Users/jgreen/Documents/R_Files/CSAT_COGS.csv")
csat$goodScore <- subset(csat, CLAGENT >= 9)
csat$goodScore[csat$CLAGENT >= 9] <- "Y"
csat$goodScore[csat$CLAGENT < 9] <- "N"
csat$RESPONSE_DATE <- as.Date(csat$RESPONSE_DATE, format="%m/%d/%Y")
csat <- subset(csat, RESPONSE_DATE >= '2013-10-01')
#summary(csat)
#names(csat)
#with(csat, plot(CLAGENT, COGS))
#ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_jitter()
#hist(csat$CLAGENT)
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram(fill="gray", color="black") + theme_bw()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=50, fill="gray", color="black") + theme_bw()
COGSBoxesByScore <- ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") #+ geom_jitter()
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,700,50)), CLAGENT)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
ScoreBoxes <- ggplot(csat, aes(goodScore,COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
ScoreCounts <- ggplot(csat, aes(goodScore)) + geom_histogram(fill="gray", color="black") + theme_bw()
grid.arrange(countsByScore, ScoreCounts, countsByCOGS, COGSBoxesByScore, ScoreBoxes, ScoreBoxesByCOGS, nrow=2)
#####################################
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram(fill="gray", color="black") + theme_bw()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=50, fill="gray", color="black") + theme_bw()
COGSBoxesByScore <- ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") #+ geom_jitter()
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,600,200)), CLAGENT)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
ScoreBoxes <- ggplot(csat, aes(goodScore,COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
ScoreCounts <- ggplot(csat, aes(goodScore)) + geom_histogram(fill="gray", color="black") + theme_bw()
grid.arrange(countsByScore, ScoreCounts, countsByCOGS, COGSBoxesByScore, ScoreBoxes, ScoreBoxesByCOGS, nrow=2)
#####################################
ggplot(csat, aes(cut(COGS, seq(0,600,100)), CLAGENT)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
ggplot(csat, aes(goodScore,COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='text',size = 3, color='red') + theme_bw()
ggplot(csat, aes(goodScore,COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
mean(csat$COGS ~ csat$CLAGENT)
mean(csat$CLAGENT ~ csat$COGS)
mean(csat$CLAGENT, csat$COGS)
tapply(csat$CLAGENT, csat$COGS, FUN=mean)
tapply(csat$COGS, csat$CLAGENT, FUN=mean)
aggregate(COGS~CLAGENT, data=csat, FUN="mean")
aggregate(COGS~goodScore, data=csat, FUN="mean")
tapply(csat$COGS, csat$goodScore, FUN=mean)
summaryBy(COGS~goodScore, data=csat, FUN="mean")
library(doBy)
install.packages("doBy")
library(doBy) # doBy for summarization
summaryBy(COGS~goodScore, data=csat, FUN="mean")
summaryBy(COGS~goodScore, data=csat, FUN="mean")
c(count=length(x), mean=mean(x),median=median(x)))
summaryBy(COGS~goodScore, data=csat, FUN="mean")
c(count=length(x), mean=mean(x),median=median(x))
summaryBy(COGS~goodScore, data=csat, FUN=function(x)
c(count=length(x), mean=mean(x),median=median(x)))
summaryBy(COGS~goodScore, data=csat, na.rm, FUN=function(x)
c(count=length(x), mean=mean(x),median=median(x)))
library(plyr)
summaryBy(COGS~goodScore, data=csat, FUN=function(x)
c(count=length(x), mean=mean(x, na.rm=TRUE),median=median(x)))
summaryBy(COGS~goodScore, data=csat, FUN=function(x)
c(count=length(x), mean=mean(x, na.rm=TRUE),median=median(x, na.rm=TRUE)))
tapply(csat$COGS, csat$goodScore, FUN=mean, na.rm=TRUE)
aggregate(COGS~goodScore, data=csat, FUN="mean", na.rm=TRUE)
ddply(csat, "goodScore", summarize, mean = mean(COGS, na.rm=TRUE))
names(csat)
ddply(csat, c("goodScore","PROP.STATE"), summarize, mean = mean(COGS, na.rm=TRUE))
ddply(csat, c("goodScore","PROP.STATE"), summarize,
mean = mean(COGS, na.rm=TRUE),
median = median(COGS, na.rm=TRUE))
ddply(csat, c("goodScore","PROP.STATE"), summarize,
Count = length(PROP.STATE),
mean = mean(COGS, na.rm=TRUE),
median = median(COGS, na.rm=TRUE))
DF <- ddply(csat, c("goodScore","PROP.STATE"), summarize,
Count = length(PROP.STATE),
mean = mean(COGS, na.rm=TRUE),
median = median(COGS, na.rm=TRUE))
edit(DF)
#install.packages("ggplot2") # Install GGPlot2 *Only needed if not already installed.
#install.packages("doBy")
library(ggplot2) # ggplot2 for creating the charts
library(scales) # scales for the dollar formatting of the axis.
library(gridExtra)
library(doBy) # doBy for summarization
library(plyr)
#Load the csv file containing the values:
csat <- read.csv("C:/Users/jgreen/Documents/R_Files/CSAT_COGS.csv")
csat$goodScore <- subset(csat, CLAGENT >= 9)
csat$goodScore[csat$CLAGENT >= 9] <- "Y"
csat$goodScore[csat$CLAGENT < 9] <- "N"
csat$RESPONSE_DATE <- as.Date(csat$RESPONSE_DATE, format="%m/%d/%Y")
csat <- subset(csat, RESPONSE_DATE >= '2013-10-01')
#summary(csat)
#names(csat)
#with(csat, plot(CLAGENT, COGS))
#ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_jitter()
#hist(csat$CLAGENT)
countsByScore <- ggplot(csat, aes(factor(CLAGENT))) + geom_histogram(fill="gray", color="black") + theme_bw()
countsByCOGS <- ggplot(csat, aes(COGS)) + geom_histogram(binwidth=50, fill="gray", color="black") + theme_bw()
COGSBoxesByScore <- ggplot(csat, aes(factor(CLAGENT),COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(factor(CLAGENT), COGS, data=csat, geom="boxplot") #+ geom_jitter()
ScoreBoxesByCOGS <- ggplot(csat, aes(cut(COGS, seq(0,600,100)), CLAGENT)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
#qplot(cut(COGS, seq(0,700,30)), CLAGENT, data=csat, geom="boxplot") + geom_jitter()
ScoreBoxes <- ggplot(csat, aes(goodScore,COGS)) + geom_boxplot(outlier.colour = "gray") +
stat_summary(fun.y='mean', geom='point',size = 3, color='red') + theme_bw()
ScoreCounts <- ggplot(csat, aes(goodScore)) + geom_histogram(fill="gray", color="black") + theme_bw()
grid.arrange(countsByScore, ScoreCounts, countsByCOGS, COGSBoxesByScore, ScoreBoxes, ScoreBoxesByCOGS, nrow=2)
max(csat$RESPONSE_DATE)
ddply(csat, "goodScore", summarize, mean = mean(COGS, na.rm=TRUE))
# Using doBy
summaryBy(COGS~goodScore, data=csat, FUN=function(x)
c(count=length(x), mean=mean(x, na.rm=TRUE),median=median(x, na.rm=TRUE)))
install.packages("knitr")
install.packages("plyr")
install.packages("quantmod")
######################################################
# Kaggle Loan Default Predictor Challenge
# Jason Green
# March, 4th 2014
# https://github.com/Convalytics/kaggle-loan-default-prediction
# Last Updated: 3/4/2014
######################################################
# Load Packages
library(plyr)
library(ggplot2)
library(gridExtra)
library(psych)
# Set Working Directory
setwd("~/GitHub/kaggle-loan-default-prediction")