-
Notifications
You must be signed in to change notification settings - Fork 3
/
code_sales.r
1122 lines (1064 loc) · 85.3 KB
/
code_sales.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
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
>train = read.csv("train.csv")
>test = read.csv("test.csv")
# After reading the given sets, we need to check whether the train set has any NA values
> table(is.na(train))
FALSE TRUE
100813 1463
# Since there are many true values that indicate the presence of NA values, lets check which columns have NA values
> colSums(is.na(train))
Item_Identifier Item_Weight Item_Fat_Content
0 1463 0
Item_Visibility Item_Type Item_MRP
0 0 0
Outlet_Identifier Outlet_Establishment_Year Outlet_Size
0 0 0
Outlet_Location_Type Outlet_Type Item_Outlet_Sales
0 0 0
# The column Item_Weight has NA values. So using the median function lets eliminate those NA values and replace it by the median of the column values
> train$Item_Weight[is.na(train$Item_Weight)] <- median(train$Item_Weight, na.rm = TRUE)
# Checking if we have any NA values now left in the column Item_Weight
> table(is.na(train$Item_Weight))
FALSE
14204
> #itemfatcontent
> prop.table(table(train$Item_Fat_Content))
LF low fat Low Fat reg Regular
0.03675021 0.01253168 0.59736694 0.01372853 0.33962264
>train$Item_Fat_Content <-gsub("low fat", "LF" , train$Item_Fat_Content)
> train$Item_Fat_Content <-gsub("LOW FAT", "LF" , train$Item_Fat_Content)
>train$Item_Fat_Content <-gsub("reg", "Regular" , train$Item_Fat_Content)
> prop.table(table(train$Item_Fat_Content))
LF Regular
0.6466488 0.3533512
#find mean of item_visibility
summary(train)
Item_Identifier Item_Weight Item_Fat_Content Item_Visibility
FDG33 : 10 Min. : 4.555 LF : 316 Min. :0.00000
FDW13 : 10 1st Qu.: 8.774 low fat: 112 1st Qu.:0.02699
DRE49 : 9 Median :12.600 Low Fat:5089 Median :0.05393
DRN47 : 9 Mean :12.858 reg : 117 Mean :0.06613
FDD38 : 9 3rd Qu.:16.850 Regular:2889 3rd Qu.:0.09459
FDF52 : 9 Max. :21.350 Max. :0.32839
(Other):8467
Item_Type Item_MRP Outlet_Identifier
Fruits and Vegetables:1232 Min. : 31.29 OUT027 : 935
Snack Foods :1200 1st Qu.: 93.83 OUT013 : 932
Household : 910 Median :143.01 OUT035 : 930
Frozen Foods : 856 Mean :140.99 OUT046 : 930
Dairy : 682 3rd Qu.:185.64 OUT049 : 930
Canned : 649 Max. :266.89 OUT045 : 929
(Other) :2994 (Other):2937
Outlet_Establishment_Year Outlet_Size Outlet_Location_Type
Min. :1985 :2410 Tier 1:2388
1st Qu.:1987 High : 932 Tier 2:2785
Median :1999 Medium:2793 Tier 3:3350
Mean :1998 Small :2388
3rd Qu.:2004
Max. :2009
Outlet_Type Item_Outlet_Sales
Grocery Store :1083 Min. : 33.29
Supermarket Type1:5577 1st Qu.: 834.25
Supermarket Type2: 928 Median : 1794.33
Supermarket Type3: 935 Mean : 2181.29
3rd Qu.: 3101.30
Max. :13086.97
#Check the column Item_Visibility
train$Item_Visibility
[1] 0.016047301 0.019278216 0.016760075 0.000000000 0.000000000 0.000000000
[7] 0.012741089 0.127469857 0.016687114 0.094449590 0.000000000 0.045463773
[13] 0.100013500 0.047257328 0.068024300 0.069088961 0.008596051 0.069196376
[19] 0.034237682 0.102492120 0.138190277 0.035399923 0.025698134 0.057556998
[25] 0.025896485 0.099887103 0.066693437 0.019356132 0.161466534 0.072221801
[31] 0.170348551 0.080829372 0.000000000 0.000000000 0.097904029 0.089291137
[37] 0.059511812 0.113123893 0.123111453 0.026480954 0.102511504 0.026818430
[43] 0.117818348 0.069102831 0.042277867 0.089498926 0.000000000 0.025879577
[49] 0.121632721 0.255394896 0.067779712 0.159803853 0.028696932 0.065041581
[55] 0.028760013 0.010053105 0.048157338 0.071958197 0.173481304 0.061082177
[61] 0.000000000 0.040071131 0.012090074 0.150285990 0.026015519 0.195068226
[67] 0.033082215 0.078946455 0.041700756 0.143422643 0.105296072 0.121531501
[73] 0.000000000 0.011324862 0.186357148 0.024205661 0.033230816 0.113720344
[79] 0.112556507 0.000000000 0.059352241 0.014087057 0.045230944 0.293417759
[85] 0.031382044 0.126398860 0.025403898 0.039057677 0.123115764 0.039624006
[91] 0.040421193 0.105274111 0.033970195 0.053212652 0.024378706 0.009714595
[97] 0.131383762 0.074613090 0.028459761 0.074627201 0.063695084 0.045797829
[103] 0.115857223 0.024832806 0.034027909 0.046769600 0.116576702 0.000000000
[109] 0.278974075 0.035913805 0.079806266 0.005505481 0.064625342 0.071636937
[115] 0.000000000 0.032677678 0.160760054 0.069110650 0.041177505 0.040081193
[121] 0.035307322 0.063017847 0.171938781 0.040197932 0.049058014 0.011610960
[127] 0.183507295 0.102349519 0.086708987 0.032835147 0.033809913 0.072669120
[133] 0.144338493 0.009163216 0.011307038 0.076855628 0.059956876 0.038532062
[139] 0.043209581 0.056816465 0.019866705 0.048331717 0.091221855 0.027622076
[145] 0.000000000 0.039355947 0.060836524 0.082316506 0.155350299 0.076841095
[151] 0.151419185 0.026001976 0.073209447 0.041683481 0.042560252 0.014081156
[157] 0.000000000 0.152918384 0.030969274 0.060376776 0.041922850 0.077367431
[163] 0.045838211 0.071077939 0.094659871 0.077608838 0.021327477 0.042485444
[169] 0.025578526 0.048980800 0.019471688 0.122918852 0.057373797 0.044155597
[175] 0.291865402 0.000000000 0.064750025 0.098312421 0.191013663 0.176573035
[181] 0.060134441 0.007294652 0.128478462 0.075107656 0.049381406 0.045165796
[187] 0.094153750 0.028907832 0.018059621 0.090436094 0.146399712 0.074264356
[193] 0.050186726 0.020631654 0.015611080 0.041395445 0.097313129 0.059582996
[199] 0.098663652 0.101338651 0.052146456 0.041764487 0.054344186 0.078362484
[205] 0.052339069 0.042464962 0.065732883 0.023625114 0.051643608 0.165694219
[211] 0.041878397 0.058091482 0.000000000 0.026903714 0.000000000 0.150554711
[217] 0.000000000 0.134975628 0.156168790 0.000000000 0.133700752 0.115119905
[223] 0.110030997 0.051038045 0.062837968 0.017116983 0.024129332 0.049754975
[229] 0.000000000 0.101561568 0.005949644 0.139561160 0.126035694 0.027164679
[235] 0.099325278 0.043573660 0.082741482 0.064565202 0.084554569 0.058451805
[241] 0.113748685 0.020603511 0.052044976 0.062764429 0.087977262 0.010010425
[247] 0.033946163 0.058414678 0.027106459 0.027022883 0.058153409 0.128937661
[253] 0.088846306 0.093577790 0.165694678 0.148392623 0.098438394 0.143303291
[259] 0.076276208 0.175103435 0.023511371 0.061052760 0.049559042 0.119418124
[265] 0.072545601 0.090486828 0.056245075 0.014618973 0.043479126 0.045166237
[271] 0.057827101 0.089394766 0.105509440 0.005234153 0.036390174 0.032928240
[277] 0.081252534 0.076552407 0.016758569 0.044248175 0.038288087 0.186032678
[283] 0.031867464 0.021370201 0.193772568 0.009866049 0.082551042 0.099729888
[289] 0.018801549 0.119721451 0.071222087 0.060371962 0.033287541 0.058584620
[295] 0.116792920 0.031452265 0.007213950 0.081196619 0.049916364 0.046270950
[301] 0.027477160 0.104704537 0.012540003 0.147023834 0.159657596 0.141398626
[307] 0.148821808 0.000000000 0.029691762 0.096715523 0.014790559 0.054378253
[313] 0.123428594 0.029943463 0.052368061 0.093861144 0.033968647 0.173154079
[319] 0.139735226 0.043351896 0.042086652 0.128482690 0.049357077 0.008326735
[325] 0.021362955 0.151420934 0.032511818 0.022323658 0.019292355 0.048124443
[331] 0.092613070 0.094697274 0.035984104 0.056596985 0.204700000 0.020618324
[337] 0.047098210 0.087584126 0.038078899 0.095102092 0.011953902 0.062799379
[343] 0.031125709 0.026005891 0.092463920 0.107765165 0.010647477 0.015749341
[349] 0.077628053 0.000000000 0.056695731 0.063993068 0.069529262 0.034452949
[355] 0.066700680 0.034699737 0.058346939 0.065203103 0.078929571 0.182514881
[361] 0.016895293 0.073379745 0.080757580 0.112271498 0.153741385 0.127929521
[367] 0.078385640 0.078502143 0.047684831 0.123159656 0.000000000 0.053392944
[373] 0.036715907 0.065236932 0.041947547 0.082888496 0.055390121 0.012194556
[379] 0.060495243 0.000000000 0.014753811 0.160707489 0.085622362 0.046350909
[385] 0.102920886 0.026604781 0.000000000 0.031860325 0.000000000 0.021250002
[391] 0.159936948 0.129503146 0.142688846 0.179484411 0.089163056 0.105761491
[397] 0.056960814 0.007040980 0.011026594 0.093203257 0.026916794 0.035264298
[403] 0.015908424 0.017719277 0.035334201 0.065652494 0.056919038 0.048143292
[409] 0.022047313 0.090427268 0.027779254 0.000000000 0.008033611 0.033088472
[415] 0.160663021 0.178975721 0.017627888 0.019415800 0.016993225 0.027139013
[421] 0.037772490 0.036746479 0.022460102 0.000000000 0.052135750 0.062508438
[427] 0.007309544 0.015623754 0.142978223 0.017191055 0.143592939 0.011995271
[433] 0.157172360 0.061393095 0.264124669 0.020310046 0.054630834 0.052517969
[439] 0.047565208 0.060797393 0.041291169 0.022604051 0.056580228 0.164196823
[445] 0.022976497 0.027310252 0.141975462 0.000000000 0.016198660 0.014205168
[451] 0.093444950 0.019199733 0.154120252 0.089004389 0.011117041 0.103422709
[457] 0.089035961 0.102723919 0.024733134 0.044871033 0.029760052 0.078999287
[463] 0.020870744 0.031599715 0.042413704 0.072284689 0.009984847 0.052852621
[469] 0.014660821 0.076354362 0.076709639 0.005677876 0.000000000 0.012282366
[475] 0.026681262 0.127541722 0.119513002 0.054463442 0.000000000 0.015756784
[481] 0.010907967 0.075435560 0.000000000 0.115194717 0.066922802 0.064636203
[487] 0.103195401 0.131210320 0.035747522 0.192650072 0.098031771 0.030118338
[493] 0.016201845 0.058373080 0.087652908 0.065999008 0.088750333 0.100277876
[499] 0.099252438 0.000000000 0.000000000 0.026384672 0.228993134 0.065431917
[505] 0.026749991 0.000000000 0.043333912 0.089656812 0.039954281 0.087854925
[511] 0.149404057 0.026895200 0.065857092 0.161817014 0.082197959 0.015335349
[517] 0.005990720 0.013898123 0.078912473 0.059776237 0.000000000 0.297883712
[523] 0.022059594 0.035324940 0.124967595 0.062411404 0.032754431 0.160178832
[529] 0.104035148 0.063900190 0.062648111 0.111685868 0.233039817 0.178245750
[535] 0.140241213 0.000000000 0.033935576 0.016516275 0.026537206 0.015673267
[541] 0.089083914 0.131152799 0.083109455 0.045818773 0.044869794 0.000000000
[547] 0.046057810 0.030815427 0.018060550 0.035205866 0.076705948 0.089677773
[553] 0.132327406 0.065520388 0.012518707 0.050353695 0.110762642 0.045050674
[559] 0.083016832 0.000000000 0.023983258 0.075836522 0.100330684 0.051778173
[565] 0.022970468 0.066014596 0.074299450 0.131128467 0.014816356 0.049318315
[571] 0.017960492 0.035801238 0.038606365 0.008871687 0.125793938 0.058369013
[577] 0.000000000 0.073269336 0.049677651 0.031470832 0.024579432 0.131665479
[583] 0.015523707 0.122475364 0.107891398 0.128065918 0.045361705 0.090390357
[589] 0.087029712 0.052054819 0.051952573 0.050786366 0.067141355 0.121485195
[595] 0.080640478 0.037699254 0.000000000 0.034501405 0.053795154 0.044004675
[601] 0.000000000 0.121250374 0.000000000 0.100230114 0.167383061 0.034404732
[607] 0.082719632 0.041913535 0.013204300 0.041105789 0.141106202 0.036463975
[613] 0.019464180 0.000000000 0.123086812 0.105646853 0.118149377 0.046545786
[619] 0.065009745 0.016630303 0.134532392 0.083133128 0.039428167 0.000000000
[625] 0.034823127 0.148492521 0.065901299 0.041622264 0.064933297 0.094549300
[631] 0.107076832 0.128674983 0.188322664 0.000000000 0.052025392 0.065316099
[637] 0.015162650 0.053584207 0.020989132 0.144017405 0.115978122 0.081465335
[643] 0.041177505 0.042352822 0.074541867 0.184541210 0.114160573 0.175352413
[649] 0.083590755 0.029471408 0.028282832 0.000000000 0.008208342 0.033349290
[655] 0.076060037 0.014301326 0.074931201 0.080131363 0.167444431 0.030337480
[661] 0.048749690 0.014788594 0.111298111 0.052685260 0.018485511 0.184689756
[667] 0.064153845 0.092516598 0.104245198 0.041779181 0.072269850 0.179806961
[673] 0.044995631 0.053523765 0.041459372 0.036234918 0.105445801 0.000000000
[679] 0.059971330 0.075595405 0.210375806 0.059341019 0.185209440 0.098566832
[685] 0.110844170 0.035015200 0.023567538 0.000000000 0.047927220 0.036207786
[691] 0.044377096 0.034742632 0.116915909 0.062979148 0.068604503 0.032948610
[697] 0.007450258 0.093027718 0.164864915 0.083498083 0.014522363 0.025963795
[703] 0.019012262 0.059393919 0.027212058 0.013263968 0.079113947 0.030208510
[709] 0.049634817 0.047187038 0.066681333 0.185218446 0.162462044 0.031273559
[715] 0.042836778 0.114127418 0.146895866 0.013420879 0.026181893 0.012184999
[721] 0.026428924 0.045243613 0.000000000 0.076790922 0.045950475 0.133673087
[727] 0.060252433 0.082529704 0.082552214 0.089272253 0.072541731 0.017536671
[733] 0.072088552 0.092781435 0.008644894 0.025342692 0.031145743 0.000000000
[739] 0.030108283 0.044391149 0.022639471 0.000000000 0.139419417 0.015278899
[745] 0.039329257 0.008579863 0.028164527 0.000000000 0.054367971 0.027346700
[751] 0.016001434 0.165328057 0.013529884 0.030510526 0.027699863 0.096467330
[757] 0.011636708 0.141642219 0.044767801 0.028009382 0.116445500 0.013584408
[763] 0.026950104 0.054751689 0.076121831 0.058516562 0.037923509 0.058365706
[769] 0.031346387 0.015663185 0.063750302 0.072524760 0.038040837 0.049823902
[775] 0.014560297 0.026408698 0.069446588 0.032171320 0.026046138 0.121848436
[781] 0.108470504 0.000000000 0.038494623 0.122830885 0.038029746 0.065207559
[787] 0.037014587 0.133281968 0.045299563 0.121149472 0.094083303 0.000000000
[793] 0.000000000 0.035022503 0.016060186 0.009014978 0.096733815 0.102607233
[799] 0.024521191 0.160624116 0.052165855 0.000000000 0.000000000 0.077536540
[805] 0.024928351 0.080711180 0.080968973 0.057485328 0.149669322 0.024776026
[811] 0.061165512 0.041718456 0.061008860 0.167799329 0.167351411 0.071832909
[817] 0.041886576 0.150341867 0.020542737 0.045047439 0.091008572 0.075493480
[823] 0.156286566 0.033735909 0.078547351 0.093653464 0.036107198 0.109003832
[829] 0.073480266 0.113234914 0.037711338 0.016054884 0.021170542 0.065188619
[835] 0.117537563 0.014303240 0.137697119 0.047008497 0.000000000 0.060863167
[841] 0.000000000 0.045105407 0.076855207 0.024482644 0.000000000 0.020474913
[847] 0.062044506 0.220225608 0.079794329 0.114916546 0.005973620 0.146973462
[853] 0.073766310 0.049349121 0.328390948 0.132670580 0.012455787 0.058142797
[859] 0.006289291 0.049295020 0.054362695 0.110356797 0.085274988 0.164542555
[865] 0.160292264 0.112859454 0.021569566 0.073055148 0.119345629 0.072334667
[871] 0.108148913 0.075853370 0.062655235 0.022278477 0.020961192 0.025993423
[877] 0.018838681 0.105577348 0.129086113 0.113125627 0.070699313 0.151467821
[883] 0.036164160 0.062606583 0.070437800 0.079844043 0.120139206 0.032028115
[889] 0.120497266 0.023492524 0.122657336 0.070588037 0.073024401 0.159587755
[895] 0.088821765 0.136810742 0.128682722 0.109459733 0.096644015 0.013120028
[901] 0.000000000 0.048339408 0.081658450 0.049753390 0.030379382 0.065810045
[907] 0.000000000 0.025272781 0.019314961 0.071282168 0.184843579 0.122896411
[913] 0.082935004 0.161350176 0.106968096 0.159582185 0.144538270 0.038685802
[919] 0.172309903 0.037690731 0.057870080 0.026409147 0.064367627 0.173516063
[925] 0.128980880 0.048115543 0.077899109 0.130932750 0.098464979 0.037372847
[931] 0.032230526 0.040357315 0.074613090 0.160936178 0.019502354 0.065577449
[937] 0.016944719 0.065576228 0.025795770 0.010008699 0.053362086 0.064621927
[943] 0.018126724 0.000000000 0.049263979 0.021343732 0.110681931 0.061955439
[949] 0.076483451 0.024701262 0.026718210 0.016597651 0.051411100 0.112985849
[955] 0.114117090 0.000000000 0.175033524 0.020760673 0.061405051 0.026676216
[961] 0.029380407 0.025715562 0.065026434 0.066315023 0.023664054 0.154627247
[967] 0.205294827 0.152261999 0.000000000 0.136275173 0.174621343 0.038597077
[973] 0.029799965 0.011314423 0.072410764 0.028118435 0.163350221 0.093307713
[979] 0.105994654 0.067055339 0.107376743 0.043810028 0.118672537 0.126897925
[985] 0.014076503 0.088305478 0.090153756 0.182501773 0.108710162 0.058446424
[991] 0.054990009 0.155288310 0.018021361 0.081655900 0.010755465 0.050111641
[997] 0.048931174 0.065960909 0.036319195 0.039055756
# Since, Item_Visibility has values such as O..which is ridiculous..and hence finding values with 0 in item_visibility and replacing it with the mean found above in item_visibility
rapply(train,function(x) ifelse(x==0,0.06613 ,x), how = "replace")
Item_Identifier Item_Weight Item_Fat_Content Item_Visibility Item_Type Item_MRP
1 157 9.300 3 0.016047301 5 249.8092
2 9 5.920 5 0.019278216 15 48.2692
3 663 17.500 3 0.016760075 11 141.6180
4 1122 19.200 5 0.066130000 7 182.0950
5 1298 8.930 3 0.066130000 10 53.8614
6 759 10.395 5 0.066130000 1 51.4008
7 697 13.650 5 0.012741089 14 57.6588
8 739 NA 3 0.127469857 14 107.7622
9 441 16.200 5 0.016687114 6 96.9726
10 991 19.200 5 0.094449590 6 187.8214
11 1172 11.800 3 0.066130000 7 45.5402
12 148 18.500 5 0.045463773 5 144.1102
13 1143 15.100 5 0.100013500 7 145.4786
14 905 17.600 5 0.047257328 14 119.6782
15 376 16.350 3 0.068024300 7 196.4426
16 768 9.000 5 0.069088961 3 56.3614
17 1281 11.800 3 0.008596051 9 115.3492
18 768 9.000 5 0.069196376 3 54.3614
19 80 NA 3 0.034237682 8 113.2834
20 969 13.350 3 0.102492120 5 230.5352
21 667 18.850 5 0.138190277 14 250.8724
22 1077 NA 5 0.035399923 1 144.5444
23 1279 14.600 3 0.025698134 10 196.5084
24 260 NA 3 0.057556998 1 107.6938
25 844 13.850 5 0.025896485 6 165.0210
26 1295 13.000 3 0.099887103 10 45.9060
27 1025 7.645 5 0.066693437 14 42.3112
28 102 11.650 2 0.019356132 8 39.1164
29 351 5.925 5 0.161466534 5 45.5086
30 245 NA 5 0.072221801 4 43.6454
31 1049 19.250 3 0.170348551 5 55.7956
32 1481 18.600 3 0.080829372 9 96.4436
33 757 18.700 3 0.066130000 14 256.6672
34 707 17.850 3 0.066130000 2 93.1436
35 65 17.500 3 0.097904029 15 174.8738
36 1534 10.000 3 0.089291137 9 146.7102
37 1033 NA 5 0.059511812 7 128.0678
38 144 8.850 5 0.113123893 15 122.5388
39 1125 NA 5 0.123111453 14 36.9874
40 215 NA 3 0.026480954 14 87.6198
41 969 13.350 3 0.102511504 5 230.6352
42 568 9.800 3 0.026818430 11 126.0020
43 181 13.600 3 0.117818348 14 192.9136
44 237 21.350 3 0.069102831 4 259.9278
45 612 12.150 5 0.042277867 4 126.5046
46 642 6.420 1 0.089498926 5 178.1002
47 1439 19.600 3 0.066130000 9 153.3024
48 1058 10.000 3 0.025879577 4 265.2226
49 587 15.850 5 0.121632721 1 60.6220
50 870 NA 5 0.255394896 5 196.8794
51 1379 7.390 3 0.067779712 9 143.8812
52 643 10.195 3 0.159803853 6 141.5154
53 831 9.895 5 0.028696932 4 117.0492
54 178 10.895 3 0.065041581 7 196.3794
55 1443 12.150 3 0.028760013 10 151.4708
56 554 7.905 3 0.010053105 14 249.0408
57 1539 9.195 3 0.048157338 10 106.1622
58 108 8.365 3 0.071958197 8 38.0506
59 1184 15.100 3 0.173481304 14 194.5110
60 486 NA 3 0.061082177 4 180.0344
61 630 10.000 3 0.066130000 7 246.9144
62 1040 7.970 5 0.040071131 11 87.3514
63 362 NA 3 0.012090074 7 38.2848
64 1200 NA 5 0.150285990 6 51.0692
65 1203 NA 3 0.026015519 14 255.8356
66 267 17.700 1 0.195068226 14 185.4266
67 442 19.350 3 0.033082215 11 172.5738
68 1219 13.650 5 0.078946455 5 186.0240
69 73 17.600 3 0.041700756 15 164.8526
70 1344 8.645 3 0.143422643 9 95.8410
71 542 15.600 5 0.105296072 14 170.1764
72 587 15.850 5 0.121531501 1 59.2220
73 454 18.250 3 0.066130000 16 164.7526
74 395 7.855 3 0.011324862 4 189.6188
75 1553 7.825 2 0.186357148 10 254.3698
76 255 8.390 5 0.024205661 6 114.0176
77 782 12.850 3 0.033230816 14 172.3422
78 683 NA 3 0.113720344 1 89.9804
79 583 19.000 3 0.112556507 6 104.9622
80 1038 5.905 3 0.066130000 4 222.5456
81 317 7.760 3 0.059352241 14 101.8700
82 657 11.800 4 0.014087057 6 180.3344
83 1054 16.750 2 0.045230944 14 187.9556
Outlet_Identifier Outlet_Establishment_Year Outlet_Size Outlet_Location_Type
1 10 1999 3 1
2 4 2009 3 3
3 10 1999 3 1
4 1 1998 1 3
5 2 1987 2 3
6 4 2009 3 3
7 2 1987 2 3
8 6 1985 3 3
9 8 2002 1 2
10 3 2007 1 2
11 10 1999 3 1
12 9 1997 4 1
13 10 1999 3 1
14 9 1997 4 1
15 2 1987 2 3
16 9 1997 4 1
17 4 2009 3 3
18 10 1999 3 1
19 6 1985 3 3
20 7 2004 4 2
21 2 1987 2 3
22 6 1985 3 3
23 7 2004 4 2
24 5 1985 4 1
25 9 1997 4 1
26 3 2007 1 2
27 7 2004 4 2
28 2 1987 2 3
29 1 1998 1 3
30 5 1985 4 1
31 1 1998 1 3
32 4 2009 3 3
33 4 2009 3 3
34 8 2002 1 2
35 9 1997 4 1
36 10 1999 3 1
37 6 1985 3 3
38 4 2009 3 3
39 6 1985 3 3
40 6 1985 3 3
41 9 1997 4 1
42 2 1987 2 3
43 10 1999 3 1
44 4 2009 3 3
45 2 1987 2 3
46 1 1998 1 3
47 8 2002 1 2
48 8 2002 1 2
49 9 1997 4 1
50 5 1985 4 1
51 9 1997 4 1
52 2 1987 2 3
53 2 1987 2 3
54 3 2007 1 2
55 3 2007 1 2
56 4 2009 3 3
57 8 2002 1 2
58 10 1999 3 1
59 9 1997 4 1
60 5 1985 4 1
61 4 2009 3 3
62 8 2002 1 2
63 6 1985 3 3
64 5 1985 4 1
65 6 1985 3 3
66 1 1998 1 3
67 7 2004 4 2
68 8 2002 1 2
69 8 2002 1 2
70 9 1997 4 1
71 9 1997 4 1
72 2 1987 2 3
73 8 2002 1 2
74 3 2007 1 2
75 10 1999 3 1
76 9 1997 4 1
77 10 1999 3 1
78 5 1985 4 1
79 3 2007 1 2
80 8 2002 1 2
81 9 1997 4 1
82 9 1997 4 1
83 4 2009 3 3
Outlet_Type Item_Outlet_Sales
1 2 3735.1380
2 3 443.4228
3 2 2097.2700
4 1 732.3800
5 2 994.7052
6 3 556.6088
7 2 343.5528
8 4 4022.7636
9 2 1076.5986
10 2 4710.5350
11 2 1516.0266
12 2 2187.1530
13 2 1589.2646
14 2 2145.2076
15 2 1977.4260
16 2 1547.3192
17 3 1621.8888
18 2 718.3982
19 4 2303.6680
20 2 2748.4224
21 2 3775.0860
22 4 4064.0432
23 2 1587.2672
24 1 214.3876
25 2 4078.0250
26 2 838.9080
27 2 1065.2800
28 2 308.9312
29 1 178.4344
30 1 125.8362
31 1 163.7868
32 3 2741.7644
33 3 3068.0064
34 2 2174.5028
35 2 2085.2856
36 2 3791.0652
37 4 2797.6916
38 3 1609.9044
39 4 388.1614
40 4 2180.4950
41 2 3435.5280
42 2 2150.5340
43 2 2527.3768
44 3 6768.5228
45 2 373.5138
46 1 358.2004
47 2 2428.8384
48 2 5815.0972
49 2 2576.6460
50 1 780.3176
51 2 3134.5864
52 2 850.8924
53 2 810.9444
54 2 3121.2704
55 2 4815.0656
56 3 6258.5200
57 2 2117.2440
58 2 796.9626
59 2 4910.2750
60 1 892.1720
61 3 3185.1872
62 2 1062.6168
63 4 484.7024
64 1 147.8076
65 4 2543.3560
66 1 184.4266
67 2 4865.6664
68 2 1118.5440
69 2 2302.3364
70 2 2027.3610
71 2 3435.5280
72 2 599.2200
73 2 4604.6728
74 2 2285.0256
75 2 5580.7356
76 2 2290.3520
77 2 1207.0954
78 1 643.1628
79 2 1587.9330
80 2 5305.0944
81 2 1697.7900
82 2 1427.4752
83 3 4693.8900
[ reached getOption("max.print") -- omitted 8440 rows ]
#seperating the first two characters of item_identifier and storing in another variable and giving its count..then renaming it
train$Item_Identifier_new <- substr(train$Item_Identifier, 1 , 2)
train$Item_Identifier_new
[1] "FD" "DR" "FD" "FD" "NC" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD"
[15] "FD" "FD" "NC" "FD" "DR" "FD" "FD" "FD" "NC" "FD" "FD" "NC" "FD" "DR"
[29] "FD" "FD" "FD" "NC" "FD" "FD" "DR" "NC" "FD" "DR" "FD" "FD" "FD" "FD"
[43] "FD" "FD" "FD" "FD" "NC" "FD" "FD" "FD" "NC" "FD" "FD" "FD" "NC" "FD"
[57] "NC" "DR" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "DR" "NC"
[71] "FD" "FD" "FD" "FD" "NC" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "NC"
[85] "FD" "FD" "FD" "FD" "FD" "FD" "FD" "DR" "DR" "FD" "NC" "FD" "FD" "FD"
[99] "NC" "FD" "FD" "FD" "FD" "DR" "FD" "FD" "FD" "FD" "DR" "DR" "FD" "FD"
[113] "FD" "FD" "FD" "FD" "FD" "FD" "DR" "FD" "NC" "DR" "FD" "FD" "FD" "FD"
[127] "DR" "FD" "DR" "NC" "FD" "NC" "NC" "FD" "FD" "NC" "FD" "FD" "FD" "NC"
[141] "NC" "NC" "NC" "NC" "FD" "FD" "FD" "NC" "FD" "NC" "DR" "FD" "FD" "DR"
[155] "FD" "NC" "FD" "FD" "DR" "FD" "FD" "FD" "FD" "DR" "FD" "DR" "FD" "FD"
[169] "NC" "FD" "NC" "FD" "FD" "FD" "FD" "FD" "FD" "NC" "DR" "FD" "FD" "FD"
[183] "NC" "FD" "FD" "FD" "FD" "NC" "FD" "NC" "FD" "FD" "FD" "FD" "NC" "FD"
[197] "FD" "NC" "FD" "FD" "NC" "FD" "FD" "FD" "FD" "FD" "FD" "DR" "FD" "FD"
[211] "DR" "DR" "FD" "NC" "NC" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD"
[225] "DR" "NC" "FD" "DR" "FD" "FD" "NC" "FD" "FD" "FD" "NC" "DR" "FD" "FD"
[239] "FD" "NC" "NC" "NC" "NC" "FD" "DR" "FD" "FD" "FD" "FD" "FD" "DR" "FD"
[253] "FD" "FD" "FD" "FD" "FD" "NC" "FD" "FD" "FD" "DR" "FD" "FD" "FD" "NC"
[267] "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD"
[281] "FD" "NC" "NC" "DR" "FD" "FD" "FD" "NC" "FD" "NC" "DR" "FD" "FD" "FD"
[295] "FD" "FD" "FD" "NC" "FD" "FD" "FD" "FD" "NC" "FD" "DR" "DR" "FD" "FD"
[309] "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "DR" "FD"
[323] "DR" "FD" "FD" "NC" "FD" "FD" "NC" "FD" "DR" "FD" "FD" "FD" "FD" "FD"
[337] "NC" "FD" "FD" "FD" "FD" "FD" "NC" "NC" "FD" "DR" "FD" "NC" "NC" "FD"
[351] "FD" "FD" "FD" "DR" "FD" "FD" "FD" "FD" "FD" "FD" "DR" "NC" "FD" "FD"
[365] "FD" "FD" "FD" "FD" "FD" "FD" "FD" "NC" "NC" "FD" "FD" "FD" "FD" "FD"
[379] "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "DR" "FD" "FD"
[393] "FD" "FD" "NC" "FD" "FD" "FD" "FD" "NC" "NC" "NC" "FD" "NC" "FD" "FD"
[407] "FD" "FD" "FD" "DR" "FD" "NC" "FD" "FD" "NC" "FD" "FD" "FD" "FD" "NC"
[421] "FD" "FD" "FD" "FD" "NC" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "DR"
[435] "FD" "DR" "NC" "FD" "FD" "FD" "FD" "FD" "FD" "NC" "FD" "FD" "FD" "DR"
[449] "NC" "NC" "FD" "FD" "FD" "FD" "FD" "NC" "FD" "FD" "DR" "NC" "FD" "FD"
[463] "FD" "NC" "DR" "FD" "NC" "FD" "FD" "FD" "NC" "FD" "FD" "FD" "FD" "FD"
[477] "NC" "FD" "FD" "NC" "FD" "DR" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD"
[491] "NC" "FD" "NC" "FD" "FD" "FD" "FD" "FD" "FD" "NC" "NC" "FD" "FD" "FD"
[505] "FD" "FD" "FD" "NC" "NC" "DR" "FD" "FD" "FD" "FD" "FD" "DR" "NC" "DR"
[519] "FD" "NC" "FD" "FD" "NC" "FD" "NC" "FD" "NC" "NC" "FD" "FD" "FD" "NC"
[533] "FD" "FD" "FD" "FD" "FD" "FD" "FD" "NC" "FD" "FD" "FD" "FD" "DR" "FD"
[547] "FD" "FD" "NC" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "NC" "FD" "FD" "FD"
[561] "DR" "DR" "FD" "FD" "FD" "DR" "FD" "FD" "FD" "FD" "FD" "NC" "FD" "FD"
[575] "DR" "FD" "DR" "DR" "FD" "NC" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "NC"
[589] "FD" "NC" "NC" "FD" "NC" "FD" "NC" "FD" "FD" "NC" "FD" "DR" "FD" "FD"
[603] "FD" "FD" "NC" "FD" "FD" "FD" "NC" "FD" "FD" "FD" "NC" "FD" "FD" "FD"
[617] "FD" "DR" "FD" "FD" "FD" "FD" "NC" "FD" "FD" "FD" "FD" "FD" "FD" "FD"
[631] "DR" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "DR"
[645] "NC" "FD" "NC" "DR" "FD" "FD" "FD" "FD" "FD" "DR" "FD" "NC" "FD" "FD"
[659] "NC" "FD" "FD" "FD" "FD" "FD" "FD" "NC" "FD" "FD" "FD" "FD" "DR" "FD"
[673] "FD" "FD" "NC" "NC" "FD" "NC" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD"
[687] "FD" "FD" "FD" "FD" "FD" "NC" "FD" "FD" "FD" "NC" "NC" "NC" "NC" "FD"
[701] "DR" "NC" "NC" "NC" "FD" "FD" "FD" "NC" "FD" "FD" "NC" "NC" "DR" "FD"
[715] "FD" "FD" "FD" "NC" "FD" "NC" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD"
[729] "FD" "FD" "FD" "FD" "DR" "FD" "NC" "FD" "NC" "FD" "FD" "FD" "FD" "FD"
[743] "FD" "FD" "NC" "FD" "DR" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "DR" "FD"
[757] "FD" "FD" "FD" "FD" "FD" "FD" "FD" "NC" "FD" "FD" "FD" "FD" "FD" "NC"
[771] "FD" "FD" "DR" "DR" "FD" "FD" "DR" "FD" "FD" "FD" "NC" "FD" "FD" "FD"
[785] "FD" "FD" "FD" "FD" "DR" "FD" "NC" "FD" "FD" "NC" "FD" "FD" "FD" "FD"
[799] "FD" "FD" "NC" "FD" "NC" "FD" "FD" "FD" "NC" "FD" "FD" "FD" "FD" "FD"
[813] "FD" "DR" "NC" "DR" "FD" "FD" "NC" "FD" "DR" "FD" "FD" "NC" "FD" "FD"
[827] "FD" "FD" "FD" "DR" "NC" "FD" "FD" "DR" "FD" "NC" "FD" "NC" "FD" "FD"
[841] "FD" "FD" "DR" "NC" "FD" "FD" "FD" "FD" "FD" "FD" "NC" "FD" "FD" "FD"
[855] "FD" "DR" "FD" "FD" "DR" "FD" "FD" "NC" "FD" "FD" "FD" "FD" "FD" "FD"
[869] "NC" "FD" "FD" "NC" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "DR" "FD" "FD"
[883] "NC" "FD" "DR" "FD" "FD" "FD" "NC" "FD" "FD" "FD" "NC" "FD" "FD" "FD"
[897] "FD" "FD" "FD" "NC" "FD" "FD" "NC" "FD" "NC" "FD" "DR" "NC" "DR" "NC"
[911] "NC" "FD" "FD" "DR" "FD" "DR" "FD" "FD" "FD" "FD" "FD" "FD" "NC" "FD"
[925] "FD" "DR" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "NC" "FD" "FD" "FD" "FD"
[939] "FD" "NC" "DR" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "NC" "FD" "FD"
[953] "FD" "FD" "FD" "FD" "FD" "FD" "FD" "FD" "NC" "FD" "NC" "FD" "FD" "FD"
[967] "DR" "FD" "NC" "FD" "FD" "FD" "FD" "NC" "FD" "FD" "FD" "NC" "FD" "FD"
[981] "FD" "FD" "FD" "FD" "FD" "FD" "FD" "NC" "FD" "FD" "NC" "FD" "FD" "NC"
[995] "DR" "FD" "NC" "FD" "DR" "NC"
[ reached getOption("max.print") -- omitted 7523 entries ]
> table(train$Item_Identifier_new)
DR FD NC
799 6125 1599
>
#Replacing with better identifiable values using the function gsub
t>train$Item_Identifier_new <-gsub("FD", "Food" , train$Item_Identifier_new)
>train$Item_Identifier_new <-gsub("NC", "Non consumable" , train$Item_Identifier_new)
>train$Item_Identifier_new <-gsub("DR", "Drinks" , train$Item_Identifier_new)
>train$Item_Identifier_new
[1] "Food" "Drinks" "Food" "Food"
[5] "Non consumable" "Food" "Food" "Food"
[9] "Food" "Food" "Food" "Food"
[13] "Food" "Food" "Food" "Food"
[17] "Non consumable" "Food" "Drinks" "Food"
[21] "Food" "Food" "Non consumable" "Food"
[25] "Food" "Non consumable" "Food" "Drinks"
[29] "Food" "Food" "Food" "Non consumable"
[33] "Food" "Food" "Drinks" "Non consumable"
[37] "Food" "Drinks" "Food" "Food"
[41] "Food" "Food" "Food" "Food"
[45] "Food" "Food" "Non consumable" "Food"
[49] "Food" "Food" "Non consumable" "Food"
[53] "Food" "Food" "Non consumable" "Food"
[57] "Non consumable" "Drinks" "Food" "Food"
[61] "Food" "Food" "Food" "Food"
[65] "Food" "Food" "Food" "Food"
[69] "Drinks" "Non consumable" "Food" "Food"
[73] "Food" "Food" "Non consumable" "Food"
[77] "Food" "Food" "Food" "Food"
[81] "Food" "Food" "Food" "Non consumable"
[85] "Food" "Food" "Food" "Food"
[89] "Food" "Food" "Food" "Drinks"
[93] "Drinks" "Food" "Non consumable" "Food"
[97] "Food" "Food" "Non consumable" "Food"
[101] "Food" "Food" "Food" "Drinks"
[105] "Food" "Food" "Food" "Food"
[109] "Drinks" "Drinks" "Food" "Food"
[113] "Food" "Food" "Food" "Food"
[117] "Food" "Food" "Drinks" "Food"
[121] "Non consumable" "Drinks" "Food" "Food"
[125] "Food" "Food" "Drinks" "Food"
[129] "Drinks" "Non consumable" "Food" "Non consumable"
[133] "Non consumable" "Food" "Food" "Non consumable"
[137] "Food" "Food" "Food" "Non consumable"
[141] "Non consumable" "Non consumable" "Non consumable" "Non consumable"
[145] "Food" "Food" "Food" "Non consumable"
[149] "Food" "Non consumable" "Drinks" "Food"
[153] "Food" "Drinks" "Food" "Non consumable"
[157] "Food" "Food" "Drinks" "Food"
[161] "Food" "Food" "Food" "Drinks"
[165] "Food" "Drinks" "Food" "Food"
[169] "Non consumable" "Food" "Non consumable" "Food"
[173] "Food" "Food" "Food" "Food"
[177] "Food" "Non consumable" "Drinks" "Food"
[181] "Food" "Food" "Non consumable" "Food"
[185] "Food" "Food" "Food" "Non consumable"
[189] "Food" "Non consumable" "Food" "Food"
[193] "Food" "Food" "Non consumable" "Food"
[197] "Food" "Non consumable" "Food" "Food"
[201] "Non consumable" "Food" "Food" "Food"
[205] "Food" "Food" "Food" "Drinks"
[209] "Food" "Food" "Drinks" "Drinks"
[213] "Food" "Non consumable" "Non consumable" "Food"
[217] "Food" "Food" "Food" "Food"
[221] "Food" "Food" "Food" "Food"
[225] "Drinks" "Non consumable" "Food" "Drinks"
[229] "Food" "Food" "Non consumable" "Food"
[233] "Food" "Food" "Non consumable" "Drinks"
[237] "Food" "Food" "Food" "Non consumable"
[241] "Non consumable" "Non consumable" "Non consumable" "Food"
[245] "Drinks" "Food" "Food" "Food"
[249] "Food" "Food" "Drinks" "Food"
[253] "Food" "Food" "Food" "Food"
[257] "Food" "Non consumable" "Food" "Food"
[261] "Food" "Drinks" "Food" "Food"
[265] "Food" "Non consumable" "Food" "Food"
[269] "Food" "Food" "Food" "Food"
[273] "Food" "Food" "Food" "Food"
[277] "Food" "Food" "Food" "Food"
[281] "Food" "Non consumable" "Non consumable" "Drinks"
[285] "Food" "Food" "Food" "Non consumable"
[289] "Food" "Non consumable" "Drinks" "Food"
[293] "Food" "Food" "Food" "Food"
[297] "Food" "Non consumable" "Food" "Food"
[301] "Food" "Food" "Non consumable" "Food"
[305] "Drinks" "Drinks" "Food" "Food"
[309] "Food" "Food" "Food" "Food"
[313] "Food" "Food" "Food" "Food"
[317] "Food" "Food" "Food" "Food"
[321] "Drinks" "Food" "Drinks" "Food"
[325] "Food" "Non consumable" "Food" "Food"
[329] "Non consumable" "Food" "Drinks" "Food"
[333] "Food" "Food" "Food" "Food"
[337] "Non consumable" "Food" "Food" "Food"
[341] "Food" "Food" "Non consumable" "Non consumable"
[345] "Food" "Drinks" "Food" "Non consumable"
[349] "Non consumable" "Food" "Food" "Food"
[353] "Food" "Drinks" "Food" "Food"
[357] "Food" "Food" "Food" "Food"
[361] "Drinks" "Non consumable" "Food" "Food"
[365] "Food" "Food" "Food" "Food"
[369] "Food" "Food" "Food" "Non consumable"
[373] "Non consumable" "Food" "Food" "Food"
[377] "Food" "Food" "Food" "Food"
[381] "Food" "Food" "Food" "Food"
[385] "Food" "Food" "Food" "Food"
[389] "Food" "Drinks" "Food" "Food"
[393] "Food" "Food" "Non consumable" "Food"
[397] "Food" "Food" "Food" "Non consumable"
[401] "Non consumable" "Non consumable" "Food" "Non consumable"
[405] "Food" "Food" "Food" "Food"
[409] "Food" "Drinks" "Food" "Non consumable"
[413] "Food" "Food" "Non consumable" "Food"
[417] "Food" "Food" "Food" "Non consumable"
[421] "Food" "Food" "Food" "Food"
[425] "Non consumable" "Food" "Food" "Food"
[429] "Food" "Food" "Food" "Food"
[433] "Food" "Drinks" "Food" "Drinks"
[437] "Non consumable" "Food" "Food" "Food"
[441] "Food" "Food" "Food" "Non consumable"
[445] "Food" "Food" "Food" "Drinks"
[449] "Non consumable" "Non consumable" "Food" "Food"
[453] "Food" "Food" "Food" "Non consumable"
[457] "Food" "Food" "Drinks" "Non consumable"
[461] "Food" "Food" "Food" "Non consumable"
[465] "Drinks" "Food" "Non consumable" "Food"
[469] "Food" "Food" "Non consumable" "Food"
[473] "Food" "Food" "Food" "Food"
[477] "Non consumable" "Food" "Food" "Non consumable"
[481] "Food" "Drinks" "Food" "Food"
[485] "Food" "Food" "Food" "Food"
[489] "Food" "Food" "Non consumable" "Food"
[493] "Non consumable" "Food" "Food" "Food"
[497] "Food" "Food" "Food" "Non consumable"
[501] "Non consumable" "Food" "Food" "Food"
[505] "Food" "Food" "Food" "Non consumable"
[509] "Non consumable" "Drinks" "Food" "Food"
[513] "Food" "Food" "Food" "Drinks"
[517] "Non consumable" "Drinks" "Food" "Non consumable"
[521] "Food" "Food" "Non consumable" "Food"
[525] "Non consumable" "Food" "Non consumable" "Non consumable"
[529] "Food" "Food" "Food" "Non consumable"
[533] "Food" "Food" "Food" "Food"
[537] "Food" "Food" "Food" "Non consumable"
[541] "Food" "Food" "Food" "Food"
[545] "Drinks" "Food" "Food" "Food"
[549] "Non consumable" "Food" "Food" "Food"
[553] "Food" "Food" "Food" "Food"
[557] "Non consumable" "Food" "Food" "Food"
[561] "Drinks" "Drinks" "Food" "Food"
[565] "Food" "Drinks" "Food" "Food"
[569] "Food" "Food" "Food" "Non consumable"
[573] "Food" "Food" "Drinks" "Food"
[577] "Drinks" "Drinks" "Food" "Non consumable"
[581] "Food" "Food" "Food" "Food"
[585] "Food" "Food" "Food" "Non consumable"
[589] "Food" "Non consumable" "Non consumable" "Food"
[593] "Non consumable" "Food" "Non consumable" "Food"
[597] "Food" "Non consumable" "Food" "Drinks"
[601] "Food" "Food" "Food" "Food"
[605] "Non consumable" "Food" "Food" "Food"
[609] "Non consumable" "Food" "Food" "Food"
[613] "Non consumable" "Food" "Food" "Food"
[617] "Food" "Drinks" "Food" "Food"
[621] "Food" "Food" "Non consumable" "Food"
[625] "Food" "Food" "Food" "Food"
[629] "Food" "Food" "Drinks" "Food"
[633] "Food" "Food" "Food" "Food"
[637] "Food" "Food" "Food" "Food"
[641] "Food" "Food" "Food" "Drinks"
[645] "Non consumable" "Food" "Non consumable" "Drinks"
[649] "Food" "Food" "Food" "Food"
[653] "Food" "Drinks" "Food" "Non consumable"
[657] "Food" "Food" "Non consumable" "Food"
[661] "Food" "Food" "Food" "Food"
[665] "Food" "Non consumable" "Food" "Food"
[669] "Food" "Food" "Drinks" "Food"
[673] "Food" "Food" "Non consumable" "Non consumable"
[677] "Food" "Non consumable" "Food" "Food"
[681] "Food" "Food" "Food" "Food"
[685] "Food" "Food" "Food" "Food"
[689] "Food" "Food" "Food" "Non consumable"
[693] "Food" "Food" "Food" "Non consumable"
[697] "Non consumable" "Non consumable" "Non consumable" "Food"
[701] "Drinks" "Non consumable" "Non consumable" "Non consumable"
[705] "Food" "Food" "Food" "Non consumable"
[709] "Food" "Food" "Non consumable" "Non consumable"
[713] "Drinks" "Food" "Food" "Food"
[717] "Food" "Non consumable" "Food" "Non consumable"
[721] "Food" "Food" "Food" "Food"
[725] "Food" "Food" "Food" "Food"
[729] "Food" "Food" "Food" "Food"
[733] "Drinks" "Food" "Non consumable" "Food"
[737] "Non consumable" "Food" "Food" "Food"
[741] "Food" "Food" "Food" "Food"
[745] "Non consumable" "Food" "Drinks" "Food"
[749] "Food" "Food" "Food" "Food"
[753] "Food" "Food" "Drinks" "Food"
[757] "Food" "Food" "Food" "Food"
[761] "Food" "Food" "Food" "Non consumable"
[765] "Food" "Food" "Food" "Food"
[769] "Food" "Non consumable" "Food" "Food"
[773] "Drinks" "Drinks" "Food" "Food"
[777] "Drinks" "Food" "Food" "Food"
[781] "Non consumable" "Food" "Food" "Food"
[785] "Food" "Food" "Food" "Food"
[789] "Drinks" "Food" "Non consumable" "Food"
[793] "Food" "Non consumable" "Food" "Food"
[797] "Food" "Food" "Food" "Food"
[801] "Non consumable" "Food" "Non consumable" "Food"
[805] "Food" "Food" "Non consumable" "Food"
[809] "Food" "Food" "Food" "Food"
[813] "Food" "Drinks" "Non consumable" "Drinks"
[817] "Food" "Food" "Non consumable" "Food"
[821] "Drinks" "Food" "Food" "Non consumable"
[825] "Food" "Food" "Food" "Food"
[829] "Food" "Drinks" "Non consumable" "Food"
[833] "Food" "Drinks" "Food" "Non consumable"
[837] "Food" "Non consumable" "Food" "Food"
[841] "Food" "Food" "Drinks" "Non consumable"
[845] "Food" "Food" "Food" "Food"
[849] "Food" "Food" "Non consumable" "Food"
[853] "Food" "Food" "Food" "Drinks"
[857] "Food" "Food" "Drinks" "Food"
[861] "Food" "Non consumable" "Food" "Food"
[865] "Food" "Food" "Food" "Food"
[869] "Non consumable" "Food" "Food" "Non consumable"
[873] "Food" "Food" "Food" "Food"
[877] "Food" "Food" "Food" "Drinks"
[881] "Food" "Food" "Non consumable" "Food"
[885] "Drinks" "Food" "Food" "Food"
[889] "Non consumable" "Food" "Food" "Food"
[893] "Non consumable" "Food" "Food" "Food"
[897] "Food" "Food" "Food" "Non consumable"
[901] "Food" "Food" "Non consumable" "Food"
[905] "Non consumable" "Food" "Drinks" "Non consumable"
[909] "Drinks" "Non consumable" "Non consumable" "Food"
[913] "Food" "Drinks" "Food" "Drinks"
[917] "Food" "Food" "Food" "Food"
[921] "Food" "Food" "Non consumable" "Food"
[925] "Food" "Drinks" "Food" "Food"
[929] "Food" "Food" "Food" "Food"
[933] "Food" "Non consumable" "Food" "Food"
[937] "Food" "Food" "Food" "Non consumable"
[941] "Drinks" "Food" "Food" "Food"
[945] "Food" "Food" "Food" "Food"
[949] "Food" "Non consumable" "Food" "Food"
[953] "Food" "Food" "Food" "Food"
[957] "Food" "Food" "Food" "Food"
[961] "Non consumable" "Food" "Non consumable" "Food"
[965] "Food" "Food" "Drinks" "Food"
[969] "Non consumable" "Food" "Food" "Food"
[973] "Food" "Non consumable" "Food" "Food"
[977] "Food" "Non consumable" "Food" "Food"
[981] "Food" "Food" "Food" "Food"
[985] "Food" "Food" "Food" "Non consumable"
[989] "Food" "Food" "Non consumable" "Food"
[993] "Food" "Non consumable" "Drinks" "Food"
[997] "Non consumable" "Food" "Drinks" "Non consumable"
[ reached getOption("max.print") -- omitted 7523 entries ]
#calculate outlet_establishment years( to check how old it is with reference to its outlet sales)
#PS. Since in the given problem..the year upto 2013 is to be considered. hence.
train$outlet_years <- 2013 - train$Outlet_Establishment_Year
> summary(train$outlet_years)
Min. 1st Qu. Median Mean 3rd Qu. Max.
4.00 9.00 14.00 15.17 26.00 28.00
# adding non edible in fat content wherever it is non consumable in item identifer new
> train$Item_Fat_Content[train$Item_Identifier_new=="Non consumable"]<- "Non edible"
> train$Item_Fat_Content
[1] "LF" "Regular" "LF" "Regular" "Non edible" "Regular"
[7] "Regular" "LF" "Regular" "Regular" "LF" "Regular"
[13] "Regular" "Regular" "LF" "Regular" "Non edible" "Regular"
[19] "LF" "LF" "Regular" "Regular" "Non edible" "LF"
[25] "Regular" "Non edible" "Regular" "LF" "Regular" "Regular"
[31] "LF" "Non edible" "LF" "LF" "LF" "Non edible"
[37] "Regular" "Regular" "Regular" "LF" "LF" "LF"
[43] "LF" "LF" "Regular" "LF" "Non edible" "LF"
[49] "Regular" "Regular" "Non edible" "LF" "Regular" "LF"
[55] "Non edible" "LF" "Non edible" "LF" "LF" "LF"
[61] "LF" "Regular" "LF" "Regular" "LF" "LF"
[67] "LF" "Regular" "LF" "Non edible" "Regular" "Regular"
[73] "LF" "LF" "Non edible" "Regular" "LF" "LF"
[79] "LF" "LF" "LF" "Regular" "LF" "Non edible"
[85] "Regular" "Regular" "LF" "Regular" "Regular" "LF"
[91] "LF" "LF" "LF" "LF" "Non edible" "LF"
[97] "LF" "Regular" "Non edible" "Regular" "LF" "Regular"
[103] "Regular" "Regular" "LF" "Regular" "Regular" "Regular"
[109] "LF" "LF" "LF" "LF" "Regular" "LF"
[115] "Regular" "LF" "Regular" "LF" "LF" "LF"
[121] "Non edible" "LF" "Regular" "Regular" "LF" "LF"
[127] "LF" "LF" "LF" "Non edible" "LF" "Non edible"
[133] "Non edible" "LF" "LF" "Non edible" "LF" "LF"
[139] "LF" "Non edible" "Non edible" "Non edible" "Non edible" "Non edible"
[145] "Regular" "LF" "LF" "Non edible" "LF" "Non edible"
[151] "LF" "Regular" "Regular" "LF" "LF" "Non edible"
[157] "Regular" "LF" "LF" "Regular" "Regular" "LF"
[163] "LF" "LF" "Regular" "Regular" "LF" "Regular"
[169] "Non edible" "LF" "Non edible" "LF" "Regular" "Regular"
[175] "LF" "LF" "Regular" "Non edible" "Regular" "LF"
[181] "Regular" "LF" "Non edible" "Regular" "Regular" "Regular"
[187] "Regular" "Non edible" "Regular" "Non edible" "LF" "Regular"
[193] "Regular" "LF" "Non edible" "LF" "Regular" "Non edible"
[199] "Regular" "Regular" "Non edible" "Regular" "LF" "LF"
[205] "LF" "Regular" "LF" "LF" "Regular" "LF"
[211] "LF" "LF" "Regular" "Non edible" "Non edible" "Regular"
[217] "Regular" "Regular" "LF" "LF" "Regular" "Regular"
[223] "Regular" "LF" "LF" "Non edible" "LF" "LF"
[229] "LF" "LF" "Non edible" "Regular" "LF" "LF"
[235] "Non edible" "LF" "Regular" "Regular" "LF" "Non edible"
[241] "Non edible" "Non edible" "Non edible" "Regular" "LF" "LF"
[247] "LF" "Regular" "LF" "LF" "LF" "LF"
[253] "LF" "Regular" "Regular" "LF" "LF" "Non edible"
[259] "Regular" "LF" "Regular" "LF" "Regular" "Regular"
[265] "LF" "Non edible" "LF" "LF" "LF" "LF"
[271] "Regular" "LF" "LF" "LF" "LF" "LF"
[277] "LF" "Regular" "LF" "LF" "Regular" "Non edible"
[283] "Non edible" "LF" "LF" "Regular" "LF" "Non edible"
[289] "Regular" "Non edible" "LF" "Regular" "LF" "LF"
[295] "Regular" "LF" "LF" "Non edible" "Regular" "LF"
[301] "Regular" "Regular" "Non edible" "LF" "LF" "LF"
[307] "LF" "LF" "LF" "LF" "Regular" "Regular"
[313] "Regular" "Regular" "Regular" "LF" "LF" "Regular"
[319] "LF" "LF" "LF" "Regular" "LF" "Regular"
[325] "LF" "Non edible" "LF" "Regular" "Non edible" "LF"
[331] "LF" "LF" "LF" "Regular" "LF" "Regular"
[337] "Non edible" "Regular" "Regular" "Regular" "Regular" "Regular"
[343] "Non edible" "Non edible" "LF" "LF" "LF" "Non edible"
[349] "Non edible" "LF" "Regular" "Regular" "Regular" "LF"
[355] "Regular" "Regular" "LF" "Regular" "Regular" "LF"
[361] "LF" "Non edible" "LF" "LF" "LF" "LF"
[367] "Regular" "Regular" "Regular" "Regular" "Regular" "Non edible"
[373] "Non edible" "LF" "Regular" "LF" "LF" "Regular"
[379] "LF" "Regular" "Regular" "LF" "Regular" "Regular"
[385] "Regular" "LF" "LF" "LF" "Regular" "LF"
[391] "LF" "LF" "Regular" "LF" "Non edible" "LF"
[397] "Regular" "Regular" "Regular" "Non edible" "Non edible" "Non edible"
[403] "LF" "Non edible" "Regular" "LF" "LF" "Regular"
[409] "LF" "LF" "LF" "Non edible" "LF" "LF"
[415] "Non edible" "LF" "Regular" "LF" "LF" "Non edible"
[421] "LF" "LF" "Regular" "Regular" "Non edible" "Regular"
[427] "LF" "LF" "Regular" "LF" "LF" "Regular"
[433] "Regular" "LF" "Regular" "LF" "Non edible" "Regular"
[439] "Regular" "LF" "LF" "LF" "Regular" "Non edible"
[445] "LF" "LF" "Regular" "LF" "Non edible" "Non edible"
[451] "LF" "Regular" "Regular" "LF" "Regular" "Non edible"
[457] "LF" "Regular" "Regular" "Non edible" "LF" "LF"
[463] "LF" "Non edible" "LF" "LF" "Non edible" "LF"
[469] "LF" "Regular" "Non edible" "LF" "LF" "Regular"
[475] "LF" "LF" "Non edible" "LF" "Regular" "Non edible"
[481] "Regular" "LF" "LF" "LF" "LF" "LF"
[487] "LF" "LF" "LF" "Regular" "Non edible" "Regular"
[493] "Non edible" "LF" "LF" "Regular" "LF" "Regular"
[499] "Regular" "Non edible" "Non edible" "LF" "LF" "Regular"
[505] "LF" "LF" "Regular" "Non edible" "Non edible" "LF"
[511] "LF" "LF" "LF" "LF" "Regular" "LF"
[517] "Non edible" "LF" "Regular" "Non edible" "Regular" "LF"
[523] "Non edible" "LF" "Non edible" "Regular" "Non edible" "Non edible"
[529] "Regular" "LF" "Regular" "Non edible" "LF" "LF"
[535] "LF" "LF" "LF" "Regular" "LF" "Non edible"
[541] "LF" "LF" "Regular" "LF" "LF" "Regular"
[547] "Regular" "LF" "Non edible" "Regular" "Regular" "LF"
[553] "LF" "Regular" "LF" "Regular" "Non edible" "LF"
[559] "LF" "Regular" "LF" "LF" "Regular" "LF"
[565] "Regular" "LF" "Regular" "Regular" "Regular" "LF"
[571] "Regular" "Non edible" "Regular" "LF" "LF" "LF"
[577] "Regular" "LF" "LF" "Non edible" "Regular" "Regular"
[583] "LF" "LF" "LF" "LF" "LF" "Non edible"
[589] "LF" "Non edible" "Non edible" "Regular" "Non edible" "Regular"
[595] "Non edible" "LF" "LF" "Non edible" "LF" "LF"
[601] "LF" "LF" "LF" "LF" "Non edible" "Regular"
[607] "LF" "LF" "Non edible" "LF" "LF" "LF"
[613] "Non edible" "Regular" "LF" "Regular" "Regular" "LF"
[619] "Regular" "Regular" "Regular" "LF" "Non edible" "LF"
[625] "LF" "LF" "Regular" "Regular" "LF" "Regular"
[631] "LF" "LF" "LF" "Regular" "LF" "Regular"
[637] "Regular" "Regular" "Regular" "Regular" "LF" "LF"
[643] "LF" "LF" "Non edible" "Regular" "Non edible" "LF"
[649] "Regular" "Regular" "Regular" "LF" "Regular" "LF"
[655] "LF" "Non edible" "Regular" "LF" "Non edible" "Regular"
[661] "LF" "LF" "LF" "Regular" "LF" "Non edible"
[667] "Regular" "LF" "Regular" "Regular" "LF" "Regular"
[673] "LF" "LF" "Non edible" "Non edible" "Regular" "Non edible"
[679] "Regular" "Regular" "Regular" "LF" "Regular" "LF"
[685] "LF" "LF" "Regular" "LF" "Regular" "LF"
[691] "LF" "Non edible" "Regular" "Regular" "Regular" "Non edible"
[697] "Non edible" "Non edible" "Non edible" "Regular" "LF" "Non edible"
[703] "Non edible" "Non edible" "LF" "LF" "Regular" "Non edible"
[709] "Regular" "LF" "Non edible" "Non edible" "LF" "LF"
[715] "LF" "LF" "Regular" "Non edible" "LF" "Non edible"
[721] "LF" "Regular" "Regular" "Regular" "Regular" "Regular"
[727] "LF" "Regular" "LF" "LF" "Regular" "Regular"
[733] "LF" "LF" "Non edible" "LF" "Non edible" "LF"
[739] "LF" "LF" "Regular" "Regular" "LF" "LF"
[745] "Non edible" "Regular" "LF" "Regular" "Regular" "Regular"
[751] "LF" "Regular" "Regular" "Regular" "LF" "Regular"
[757] "LF" "LF" "LF" "LF" "LF" "Regular"