worked on Groceires data . Here main objective is to see customers purchased and also to optimize sales in the items .

library(arulesViz)
## Loading required package: arules
## Loading required package: Matrix
## 
## Attaching package: 'arules'
## The following objects are masked from 'package:base':
## 
##     abbreviate, write
## Loading required package: grid
## Registered S3 method overwritten by 'seriation':
##   method         from 
##   reorder.hclust gclus
library(caTools)
library(arules)
data("Groceries")
summary(Groceries)
## transactions as itemMatrix in sparse format with
##  9835 rows (elements/itemsets/transactions) and
##  169 columns (items) and a density of 0.02609146 
## 
## most frequent items:
##       whole milk other vegetables       rolls/buns             soda 
##             2513             1903             1809             1715 
##           yogurt          (Other) 
##             1372            34055 
## 
## element (itemset/transaction) length distribution:
## sizes
##    1    2    3    4    5    6    7    8    9   10   11   12   13   14   15   16 
## 2159 1643 1299 1005  855  645  545  438  350  246  182  117   78   77   55   46 
##   17   18   19   20   21   22   23   24   26   27   28   29   32 
##   29   14   14    9   11    4    6    1    1    1    1    3    1 
## 
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   1.000   2.000   3.000   4.409   6.000  32.000 
## 
## includes extended item information - examples:
##        labels  level2           level1
## 1 frankfurter sausage meat and sausage
## 2     sausage sausage meat and sausage
## 3  liver loaf sausage meat and sausage
nrow(Groceries)
## [1] 9835
itemFrequencyPlot(Groceries, support=0.1, cex.names=0.8)

itemFrequencyPlot(Groceries, support=0.05, cex.names=0.8)

itemFrequencyPlot(Groceries, topN=20)

Rules (Apriori)

rules <- apriori(Groceries, parameter = list(support = 0.009, confidence = 0.25, minlen = 2))
## Apriori
## 
## Parameter specification:
##  confidence minval smax arem  aval originalSupport maxtime support minlen
##        0.25    0.1    1 none FALSE            TRUE       5   0.009      2
##  maxlen target  ext
##      10  rules TRUE
## 
## Algorithmic control:
##  filter tree heap memopt load sort verbose
##     0.1 TRUE TRUE  FALSE TRUE    2    TRUE
## 
## Absolute minimum support count: 88 
## 
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[169 item(s), 9835 transaction(s)] done [0.00s].
## sorting and recoding items ... [93 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 done [0.00s].
## writing ... [224 rule(s)] done [0.00s].
## creating S4 object  ... done [0.00s].
inspect(rules)
##       lhs                           rhs                      support confidence   coverage      lift count
## [1]   {baking powder}            => {whole milk}         0.009252669  0.5229885 0.01769192 2.0467935    91
## [2]   {grapes}                   => {other vegetables}   0.009049314  0.4045455 0.02236909 2.0907538    89
## [3]   {meat}                     => {other vegetables}   0.009964413  0.3858268 0.02582613 1.9940128    98
## [4]   {meat}                     => {whole milk}         0.009964413  0.3858268 0.02582613 1.5099906    98
## [5]   {frozen meals}             => {whole milk}         0.009862735  0.3476703 0.02836807 1.3606593    97
## [6]   {hard cheese}              => {other vegetables}   0.009456024  0.3858921 0.02450432 1.9943505    93
## [7]   {hard cheese}              => {whole milk}         0.010066090  0.4107884 0.02450432 1.6076815    99
## [8]   {butter milk}              => {other vegetables}   0.010371124  0.3709091 0.02796136 1.9169159   102
## [9]   {butter milk}              => {whole milk}         0.011591256  0.4145455 0.02796136 1.6223854   114
## [10]  {ham}                      => {other vegetables}   0.009150991  0.3515625 0.02602949 1.8169297    90
## [11]  {ham}                      => {whole milk}         0.011489578  0.4414062 0.02602949 1.7275091   113
## [12]  {sliced cheese}            => {other vegetables}   0.009049314  0.3692946 0.02450432 1.9085720    89
## [13]  {sliced cheese}            => {whole milk}         0.010777834  0.4398340 0.02450432 1.7213560   106
## [14]  {oil}                      => {other vegetables}   0.009964413  0.3550725 0.02806304 1.8350697    98
## [15]  {oil}                      => {whole milk}         0.011286223  0.4021739 0.02806304 1.5739675   111
## [16]  {onions}                   => {root vegetables}    0.009456024  0.3049180 0.03101169 2.7974523    93
## [17]  {onions}                   => {other vegetables}   0.014234875  0.4590164 0.03101169 2.3722681   140
## [18]  {onions}                   => {whole milk}         0.012099644  0.3901639 0.03101169 1.5269647   119
## [19]  {berries}                  => {whipped/sour cream} 0.009049314  0.2721713 0.03324860 3.7968855    89
## [20]  {berries}                  => {yogurt}             0.010574479  0.3180428 0.03324860 2.2798477   104
## [21]  {berries}                  => {other vegetables}   0.010269446  0.3088685 0.03324860 1.5962805   101
## [22]  {berries}                  => {whole milk}         0.011794611  0.3547401 0.03324860 1.3883281   116
## [23]  {hamburger meat}           => {other vegetables}   0.013828165  0.4159021 0.03324860 2.1494470   136
## [24]  {hamburger meat}           => {whole milk}         0.014743264  0.4434251 0.03324860 1.7354101   145
## [25]  {hygiene articles}         => {other vegetables}   0.009557702  0.2901235 0.03294357 1.4994032    94
## [26]  {hygiene articles}         => {whole milk}         0.012811388  0.3888889 0.03294357 1.5219746   126
## [27]  {salty snack}              => {other vegetables}   0.010777834  0.2849462 0.03782410 1.4726465   106
## [28]  {salty snack}              => {whole milk}         0.011184545  0.2956989 0.03782410 1.1572618   110
## [29]  {sugar}                    => {other vegetables}   0.010777834  0.3183183 0.03385867 1.6451186   106
## [30]  {sugar}                    => {whole milk}         0.015048297  0.4444444 0.03385867 1.7393996   148
## [31]  {waffles}                  => {other vegetables}   0.010066090  0.2619048 0.03843416 1.3535645    99
## [32]  {waffles}                  => {whole milk}         0.012709710  0.3306878 0.03843416 1.2941961   125
## [33]  {long life bakery product} => {other vegetables}   0.010676157  0.2853261 0.03741739 1.4746096   105
## [34]  {long life bakery product} => {whole milk}         0.013523132  0.3614130 0.03741739 1.4144438   133
## [35]  {dessert}                  => {soda}               0.009862735  0.2657534 0.03711235 1.5240145    97
## [36]  {dessert}                  => {yogurt}             0.009862735  0.2657534 0.03711235 1.9050182    97
## [37]  {dessert}                  => {other vegetables}   0.011591256  0.3123288 0.03711235 1.6141636   114
## [38]  {dessert}                  => {whole milk}         0.013726487  0.3698630 0.03711235 1.4475140   135
## [39]  {cream cheese }            => {yogurt}             0.012404677  0.3128205 0.03965430 2.2424123   122
## [40]  {cream cheese }            => {rolls/buns}         0.009964413  0.2512821 0.03965430 1.3661465    98
## [41]  {cream cheese }            => {other vegetables}   0.013726487  0.3461538 0.03965430 1.7889769   135
## [42]  {cream cheese }            => {whole milk}         0.016471784  0.4153846 0.03965430 1.6256696   162
## [43]  {chicken}                  => {root vegetables}    0.010879512  0.2535545 0.04290798 2.3262206   107
## [44]  {chicken}                  => {other vegetables}   0.017895272  0.4170616 0.04290798 2.1554393   176
## [45]  {chicken}                  => {whole milk}         0.017590239  0.4099526 0.04290798 1.6044106   173
## [46]  {white bread}              => {other vegetables}   0.013726487  0.3260870 0.04209456 1.6852681   135
## [47]  {white bread}              => {whole milk}         0.017081851  0.4057971 0.04209456 1.5881474   168
## [48]  {chocolate}                => {soda}               0.013523132  0.2725410 0.04961871 1.5629391   133
## [49]  {chocolate}                => {other vegetables}   0.012709710  0.2561475 0.04961871 1.3238103   125
## [50]  {chocolate}                => {whole milk}         0.016675140  0.3360656 0.04961871 1.3152427   164
## [51]  {coffee}                   => {whole milk}         0.018708693  0.3222417 0.05805796 1.2611408   184
## [52]  {frozen vegetables}        => {yogurt}             0.012404677  0.2579281 0.04809354 1.8489235   122
## [53]  {frozen vegetables}        => {other vegetables}   0.017793594  0.3699789 0.04809354 1.9121083   175
## [54]  {frozen vegetables}        => {whole milk}         0.020437214  0.4249471 0.04809354 1.6630940   201
## [55]  {beef}                     => {root vegetables}    0.017386884  0.3313953 0.05246568 3.0403668   171
## [56]  {beef}                     => {rolls/buns}         0.013624809  0.2596899 0.05246568 1.4118576   134
## [57]  {beef}                     => {other vegetables}   0.019725470  0.3759690 0.05246568 1.9430662   194
## [58]  {beef}                     => {whole milk}         0.021250635  0.4050388 0.05246568 1.5851795   209
## [59]  {curd}                     => {yogurt}             0.017285206  0.3244275 0.05327911 2.3256154   170
## [60]  {curd}                     => {other vegetables}   0.017183528  0.3225191 0.05327911 1.6668288   169
## [61]  {curd}                     => {whole milk}         0.026131164  0.4904580 0.05327911 1.9194805   257
## [62]  {napkins}                  => {other vegetables}   0.014438231  0.2757282 0.05236401 1.4250060   142
## [63]  {napkins}                  => {whole milk}         0.019725470  0.3766990 0.05236401 1.4742678   194
## [64]  {pork}                     => {other vegetables}   0.021657346  0.3756614 0.05765125 1.9414764   213
## [65]  {pork}                     => {whole milk}         0.022165735  0.3844797 0.05765125 1.5047187   218
## [66]  {frankfurter}              => {rolls/buns}         0.019217082  0.3258621 0.05897306 1.7716161   189
## [67]  {frankfurter}              => {other vegetables}   0.016471784  0.2793103 0.05897306 1.4435193   162
## [68]  {frankfurter}              => {whole milk}         0.020538892  0.3482759 0.05897306 1.3630295   202
## [69]  {bottled beer}             => {whole milk}         0.020437214  0.2537879 0.08052872 0.9932367   201
## [70]  {brown bread}              => {other vegetables}   0.018708693  0.2884013 0.06487036 1.4905025   184
## [71]  {brown bread}              => {whole milk}         0.025216065  0.3887147 0.06487036 1.5212930   248
## [72]  {margarine}                => {rolls/buns}         0.014743264  0.2517361 0.05856634 1.3686151   145
## [73]  {margarine}                => {other vegetables}   0.019725470  0.3368056 0.05856634 1.7406635   194
## [74]  {margarine}                => {whole milk}         0.024199288  0.4131944 0.05856634 1.6170980   238
## [75]  {butter}                   => {yogurt}             0.014641586  0.2642202 0.05541434 1.8940273   144
## [76]  {butter}                   => {other vegetables}   0.020030503  0.3614679 0.05541434 1.8681223   197
## [77]  {butter}                   => {whole milk}         0.027554652  0.4972477 0.05541434 1.9460530   271
## [78]  {newspapers}               => {whole milk}         0.027351296  0.3426752 0.07981698 1.3411103   269
## [79]  {domestic eggs}            => {other vegetables}   0.022267412  0.3509615 0.06344687 1.8138238   219
## [80]  {domestic eggs}            => {whole milk}         0.029994916  0.4727564 0.06344687 1.8502027   295
## [81]  {fruit/vegetable juice}    => {soda}               0.018403660  0.2545710 0.07229283 1.4598869   181
## [82]  {fruit/vegetable juice}    => {yogurt}             0.018708693  0.2587904 0.07229283 1.8551049   184
## [83]  {fruit/vegetable juice}    => {other vegetables}   0.021047280  0.2911392 0.07229283 1.5046529   207
## [84]  {fruit/vegetable juice}    => {whole milk}         0.026639553  0.3684951 0.07229283 1.4421604   262
## [85]  {whipped/sour cream}       => {yogurt}             0.020742247  0.2893617 0.07168277 2.0742510   204
## [86]  {whipped/sour cream}       => {other vegetables}   0.028876462  0.4028369 0.07168277 2.0819237   284
## [87]  {whipped/sour cream}       => {whole milk}         0.032231825  0.4496454 0.07168277 1.7597542   317
## [88]  {pip fruit}                => {tropical fruit}     0.020437214  0.2701613 0.07564820 2.5746476   201
## [89]  {pip fruit}                => {other vegetables}   0.026131164  0.3454301 0.07564820 1.7852365   257
## [90]  {pip fruit}                => {whole milk}         0.030096594  0.3978495 0.07564820 1.5570432   296
## [91]  {pastry}                   => {other vegetables}   0.022572445  0.2537143 0.08896797 1.3112349   222
## [92]  {pastry}                   => {whole milk}         0.033248602  0.3737143 0.08896797 1.4625865   327
## [93]  {citrus fruit}             => {yogurt}             0.021657346  0.2616708 0.08276563 1.8757521   213
## [94]  {citrus fruit}             => {other vegetables}   0.028876462  0.3488943 0.08276563 1.8031403   284
## [95]  {citrus fruit}             => {whole milk}         0.030503305  0.3685504 0.08276563 1.4423768   300
## [96]  {sausage}                  => {soda}               0.024300966  0.2586580 0.09395018 1.4833245   239
## [97]  {sausage}                  => {rolls/buns}         0.030604982  0.3257576 0.09395018 1.7710480   301
## [98]  {sausage}                  => {other vegetables}   0.026944586  0.2867965 0.09395018 1.4822091   265
## [99]  {sausage}                  => {whole milk}         0.029893238  0.3181818 0.09395018 1.2452520   294
## [100] {bottled water}            => {soda}               0.028978139  0.2621895 0.11052364 1.5035766   285
## [101] {bottled water}            => {whole milk}         0.034367056  0.3109476 0.11052364 1.2169396   338
## [102] {tropical fruit}           => {yogurt}             0.029283172  0.2790698 0.10493137 2.0004746   288
## [103] {tropical fruit}           => {other vegetables}   0.035892222  0.3420543 0.10493137 1.7677896   353
## [104] {tropical fruit}           => {whole milk}         0.042297916  0.4031008 0.10493137 1.5775950   416
## [105] {root vegetables}          => {other vegetables}   0.047381800  0.4347015 0.10899847 2.2466049   466
## [106] {root vegetables}          => {whole milk}         0.048906965  0.4486940 0.10899847 1.7560310   481
## [107] {yogurt}                   => {other vegetables}   0.043416370  0.3112245 0.13950178 1.6084566   427
## [108] {yogurt}                   => {whole milk}         0.056024403  0.4016035 0.13950178 1.5717351   551
## [109] {rolls/buns}               => {whole milk}         0.056634469  0.3079049 0.18393493 1.2050318   557
## [110] {other vegetables}         => {whole milk}         0.074834774  0.3867578 0.19349263 1.5136341   736
## [111] {whole milk}               => {other vegetables}   0.074834774  0.2928770 0.25551601 1.5136341   736
## [112] {other vegetables,                                                                                  
##        frozen vegetables}        => {whole milk}         0.009659380  0.5428571 0.01779359 2.1245523    95
## [113] {whole milk,                                                                                        
##        frozen vegetables}        => {other vegetables}   0.009659380  0.4726368 0.02043721 2.4426606    95
## [114] {beef,                                                                                              
##        other vegetables}         => {whole milk}         0.009252669  0.4690722 0.01972547 1.8357838    91
## [115] {beef,                                                                                              
##        whole milk}               => {other vegetables}   0.009252669  0.4354067 0.02125064 2.2502495    91
## [116] {curd,                                                                                              
##        yogurt}                   => {whole milk}         0.010066090  0.5823529 0.01728521 2.2791250    99
## [117] {whole milk,                                                                                        
##        curd}                     => {yogurt}             0.010066090  0.3852140 0.02613116 2.7613555    99
## [118] {other vegetables,                                                                                  
##        curd}                     => {whole milk}         0.009862735  0.5739645 0.01718353 2.2462956    97
## [119] {whole milk,                                                                                        
##        curd}                     => {other vegetables}   0.009862735  0.3774319 0.02613116 1.9506268    97
## [120] {pork,                                                                                              
##        other vegetables}         => {whole milk}         0.010167768  0.4694836 0.02165735 1.8373939   100
## [121] {pork,                                                                                              
##        whole milk}               => {other vegetables}   0.010167768  0.4587156 0.02216573 2.3707136   100
## [122] {other vegetables,                                                                                  
##        brown bread}              => {whole milk}         0.009354347  0.5000000 0.01870869 1.9568245    92
## [123] {whole milk,                                                                                        
##        brown bread}              => {other vegetables}   0.009354347  0.3709677 0.02521607 1.9172190    92
## [124] {other vegetables,                                                                                  
##        margarine}                => {whole milk}         0.009252669  0.4690722 0.01972547 1.8357838    91
## [125] {whole milk,                                                                                        
##        margarine}                => {other vegetables}   0.009252669  0.3823529 0.02419929 1.9760595    91
## [126] {butter,                                                                                            
##        yogurt}                   => {whole milk}         0.009354347  0.6388889 0.01464159 2.5003869    92
## [127] {whole milk,                                                                                        
##        butter}                   => {yogurt}             0.009354347  0.3394834 0.02755465 2.4335417    92
## [128] {other vegetables,                                                                                  
##        butter}                   => {whole milk}         0.011489578  0.5736041 0.02003050 2.2448850   113
## [129] {whole milk,                                                                                        
##        butter}                   => {other vegetables}   0.011489578  0.4169742 0.02755465 2.1549874   113
## [130] {other vegetables,                                                                                  
##        domestic eggs}            => {whole milk}         0.012302999  0.5525114 0.02226741 2.1623358   121
## [131] {whole milk,                                                                                        
##        domestic eggs}            => {other vegetables}   0.012302999  0.4101695 0.02999492 2.1198197   121
## [132] {yogurt,                                                                                            
##        fruit/vegetable juice}    => {whole milk}         0.009456024  0.5054348 0.01870869 1.9780943    93
## [133] {whole milk,                                                                                        
##        fruit/vegetable juice}    => {yogurt}             0.009456024  0.3549618 0.02663955 2.5444968    93
## [134] {other vegetables,                                                                                  
##        fruit/vegetable juice}    => {whole milk}         0.010472801  0.4975845 0.02104728 1.9473713   103
## [135] {whole milk,                                                                                        
##        fruit/vegetable juice}    => {other vegetables}   0.010472801  0.3931298 0.02663955 2.0317558   103
## [136] {root vegetables,                                                                                   
##        whipped/sour cream}       => {whole milk}         0.009456024  0.5535714 0.01708185 2.1664843    93
## [137] {whole milk,                                                                                        
##        whipped/sour cream}       => {root vegetables}    0.009456024  0.2933754 0.03223183 2.6915550    93
## [138] {yogurt,                                                                                            
##        whipped/sour cream}       => {other vegetables}   0.010167768  0.4901961 0.02074225 2.5334096   100
## [139] {other vegetables,                                                                                  
##        whipped/sour cream}       => {yogurt}             0.010167768  0.3521127 0.02887646 2.5240730   100
## [140] {yogurt,                                                                                            
##        whipped/sour cream}       => {whole milk}         0.010879512  0.5245098 0.02074225 2.0527473   107
## [141] {whole milk,                                                                                        
##        whipped/sour cream}       => {yogurt}             0.010879512  0.3375394 0.03223183 2.4196066   107
## [142] {other vegetables,                                                                                  
##        whipped/sour cream}       => {whole milk}         0.014641586  0.5070423 0.02887646 1.9843854   144
## [143] {whole milk,                                                                                        
##        whipped/sour cream}       => {other vegetables}   0.014641586  0.4542587 0.03223183 2.3476795   144
## [144] {tropical fruit,                                                                                    
##        pip fruit}                => {other vegetables}   0.009456024  0.4626866 0.02043721 2.3912361    93
## [145] {pip fruit,                                                                                         
##        other vegetables}         => {tropical fruit}     0.009456024  0.3618677 0.02613116 3.4486132    93
## [146] {tropical fruit,                                                                                    
##        other vegetables}         => {pip fruit}          0.009456024  0.2634561 0.03589222 3.4826487    93
## [147] {pip fruit,                                                                                         
##        yogurt}                   => {whole milk}         0.009557702  0.5310734 0.01799695 2.0784351    94
## [148] {pip fruit,                                                                                         
##        whole milk}               => {yogurt}             0.009557702  0.3175676 0.03009659 2.2764410    94
## [149] {pip fruit,                                                                                         
##        other vegetables}         => {whole milk}         0.013523132  0.5175097 0.02613116 2.0253514   133
## [150] {pip fruit,                                                                                         
##        whole milk}               => {other vegetables}   0.013523132  0.4493243 0.03009659 2.3221780   133
## [151] {yogurt,                                                                                            
##        pastry}                   => {whole milk}         0.009150991  0.5172414 0.01769192 2.0243012    90
## [152] {whole milk,                                                                                        
##        pastry}                   => {yogurt}             0.009150991  0.2752294 0.03324860 1.9729451    90
## [153] {other vegetables,                                                                                  
##        pastry}                   => {whole milk}         0.010574479  0.4684685 0.02257245 1.8334212   104
## [154] {whole milk,                                                                                        
##        pastry}                   => {other vegetables}   0.010574479  0.3180428 0.03324860 1.6436947   104
## [155] {citrus fruit,                                                                                      
##        tropical fruit}           => {other vegetables}   0.009049314  0.4540816 0.01992883 2.3467645    89
## [156] {citrus fruit,                                                                                      
##        other vegetables}         => {tropical fruit}     0.009049314  0.3133803 0.02887646 2.9865262    89
## [157] {tropical fruit,                                                                                    
##        other vegetables}         => {citrus fruit}       0.009049314  0.2521246 0.03589222 3.0462480    89
## [158] {citrus fruit,                                                                                      
##        tropical fruit}           => {whole milk}         0.009049314  0.4540816 0.01992883 1.7771161    89
## [159] {citrus fruit,                                                                                      
##        whole milk}               => {tropical fruit}     0.009049314  0.2966667 0.03050330 2.8272448    89
## [160] {citrus fruit,                                                                                      
##        root vegetables}          => {other vegetables}   0.010371124  0.5862069 0.01769192 3.0296084   102
## [161] {citrus fruit,                                                                                      
##        other vegetables}         => {root vegetables}    0.010371124  0.3591549 0.02887646 3.2950455   102
## [162] {citrus fruit,                                                                                      
##        root vegetables}          => {whole milk}         0.009150991  0.5172414 0.01769192 2.0243012    90
## [163] {citrus fruit,                                                                                      
##        whole milk}               => {root vegetables}    0.009150991  0.3000000 0.03050330 2.7523321    90
## [164] {citrus fruit,                                                                                      
##        yogurt}                   => {whole milk}         0.010269446  0.4741784 0.02165735 1.8557678   101
## [165] {citrus fruit,                                                                                      
##        whole milk}               => {yogurt}             0.010269446  0.3366667 0.03050330 2.4133503   101
## [166] {citrus fruit,                                                                                      
##        other vegetables}         => {whole milk}         0.013014743  0.4507042 0.02887646 1.7638982   128
## [167] {citrus fruit,                                                                                      
##        whole milk}               => {other vegetables}   0.013014743  0.4266667 0.03050330 2.2050797   128
## [168] {sausage,                                                                                           
##        soda}                     => {rolls/buns}         0.009659380  0.3974895 0.02430097 2.1610335    95
## [169] {sausage,                                                                                           
##        rolls/buns}               => {soda}               0.009659380  0.3156146 0.03060498 1.8099532    95
## [170] {rolls/buns,                                                                                        
##        soda}                     => {sausage}            0.009659380  0.2519894 0.03833249 2.6821598    95
## [171] {sausage,                                                                                           
##        rolls/buns}               => {whole milk}         0.009354347  0.3056478 0.03060498 1.1961984    92
## [172] {sausage,                                                                                           
##        whole milk}               => {rolls/buns}         0.009354347  0.3129252 0.02989324 1.7012820    92
## [173] {sausage,                                                                                           
##        other vegetables}         => {whole milk}         0.010167768  0.3773585 0.02694459 1.4768487   100
## [174] {sausage,                                                                                           
##        whole milk}               => {other vegetables}   0.010167768  0.3401361 0.02989324 1.7578760   100
## [175] {yogurt,                                                                                            
##        bottled water}            => {whole milk}         0.009659380  0.4203540 0.02297916 1.6451180    95
## [176] {whole milk,                                                                                        
##        bottled water}            => {yogurt}             0.009659380  0.2810651 0.03436706 2.0147778    95
## [177] {other vegetables,                                                                                  
##        bottled water}            => {whole milk}         0.010777834  0.4344262 0.02480935 1.7001918   106
## [178] {whole milk,                                                                                        
##        bottled water}            => {other vegetables}   0.010777834  0.3136095 0.03436706 1.6207825   106
## [179] {tropical fruit,                                                                                    
##        root vegetables}          => {other vegetables}   0.012302999  0.5845411 0.02104728 3.0209991   121
## [180] {tropical fruit,                                                                                    
##        other vegetables}         => {root vegetables}    0.012302999  0.3427762 0.03589222 3.1447798   121
## [181] {root vegetables,                                                                                   
##        other vegetables}         => {tropical fruit}     0.012302999  0.2596567 0.04738180 2.4745380   121
## [182] {tropical fruit,                                                                                    
##        root vegetables}          => {whole milk}         0.011997966  0.5700483 0.02104728 2.2309690   118
## [183] {tropical fruit,                                                                                    
##        whole milk}               => {root vegetables}    0.011997966  0.2836538 0.04229792 2.6023653   118
## [184] {tropical fruit,                                                                                    
##        yogurt}                   => {other vegetables}   0.012302999  0.4201389 0.02928317 2.1713431   121
## [185] {tropical fruit,                                                                                    
##        other vegetables}         => {yogurt}             0.012302999  0.3427762 0.03589222 2.4571457   121
## [186] {other vegetables,                                                                                  
##        yogurt}                   => {tropical fruit}     0.012302999  0.2833724 0.04341637 2.7005496   121
## [187] {tropical fruit,                                                                                    
##        yogurt}                   => {whole milk}         0.015149975  0.5173611 0.02928317 2.0247698   149
## [188] {tropical fruit,                                                                                    
##        whole milk}               => {yogurt}             0.015149975  0.3581731 0.04229792 2.5675162   149
## [189] {whole milk,                                                                                        
##        yogurt}                   => {tropical fruit}     0.015149975  0.2704174 0.05602440 2.5770885   149
## [190] {tropical fruit,                                                                                    
##        rolls/buns}               => {whole milk}         0.010981190  0.4462810 0.02460600 1.7465872   108
## [191] {tropical fruit,                                                                                    
##        whole milk}               => {rolls/buns}         0.010981190  0.2596154 0.04229792 1.4114524   108
## [192] {tropical fruit,                                                                                    
##        other vegetables}         => {whole milk}         0.017081851  0.4759207 0.03589222 1.8625865   168
## [193] {tropical fruit,                                                                                    
##        whole milk}               => {other vegetables}   0.017081851  0.4038462 0.04229792 2.0871397   168
## [194] {root vegetables,                                                                                   
##        yogurt}                   => {other vegetables}   0.012913066  0.5000000 0.02582613 2.5840778   127
## [195] {root vegetables,                                                                                   
##        other vegetables}         => {yogurt}             0.012913066  0.2725322 0.04738180 1.9536108   127
## [196] {other vegetables,                                                                                  
##        yogurt}                   => {root vegetables}    0.012913066  0.2974239 0.04341637 2.7286977   127
## [197] {root vegetables,                                                                                   
##        yogurt}                   => {whole milk}         0.014539908  0.5629921 0.02582613 2.2033536   143
## [198] {root vegetables,                                                                                   
##        whole milk}               => {yogurt}             0.014539908  0.2972973 0.04890696 2.1311362   143
## [199] {whole milk,                                                                                        
##        yogurt}                   => {root vegetables}    0.014539908  0.2595281 0.05602440 2.3810253   143
## [200] {root vegetables,                                                                                   
##        rolls/buns}               => {other vegetables}   0.012201322  0.5020921 0.02430097 2.5948898   120
## [201] {root vegetables,                                                                                   
##        other vegetables}         => {rolls/buns}         0.012201322  0.2575107 0.04738180 1.4000100   120
## [202] {other vegetables,                                                                                  
##        rolls/buns}               => {root vegetables}    0.012201322  0.2863962 0.04260295 2.6275247   120
## [203] {root vegetables,                                                                                   
##        rolls/buns}               => {whole milk}         0.012709710  0.5230126 0.02430097 2.0468876   125
## [204] {root vegetables,                                                                                   
##        whole milk}               => {rolls/buns}         0.012709710  0.2598753 0.04890696 1.4128652   125
## [205] {root vegetables,                                                                                   
##        other vegetables}         => {whole milk}         0.023182511  0.4892704 0.04738180 1.9148326   228
## [206] {root vegetables,                                                                                   
##        whole milk}               => {other vegetables}   0.023182511  0.4740125 0.04890696 2.4497702   228
## [207] {other vegetables,                                                                                  
##        whole milk}               => {root vegetables}    0.023182511  0.3097826 0.07483477 2.8420820   228
## [208] {yogurt,                                                                                            
##        soda}                     => {whole milk}         0.010472801  0.3828996 0.02735130 1.4985348   103
## [209] {whole milk,                                                                                        
##        soda}                     => {yogurt}             0.010472801  0.2614213 0.04006101 1.8739641   103
## [210] {rolls/buns,                                                                                        
##        soda}                     => {other vegetables}   0.009862735  0.2572944 0.03833249 1.3297376    97
## [211] {other vegetables,                                                                                  
##        soda}                     => {rolls/buns}         0.009862735  0.3012422 0.03274021 1.6377653    97
## [212] {other vegetables,                                                                                  
##        soda}                     => {whole milk}         0.013929842  0.4254658 0.03274021 1.6651240   137
## [213] {whole milk,                                                                                        
##        soda}                     => {other vegetables}   0.013929842  0.3477157 0.04006101 1.7970490   137
## [214] {yogurt,                                                                                            
##        rolls/buns}               => {other vegetables}   0.011489578  0.3343195 0.03436706 1.7278153   113
## [215] {other vegetables,                                                                                  
##        yogurt}                   => {rolls/buns}         0.011489578  0.2646370 0.04341637 1.4387534   113
## [216] {other vegetables,                                                                                  
##        rolls/buns}               => {yogurt}             0.011489578  0.2696897 0.04260295 1.9332351   113
## [217] {yogurt,                                                                                            
##        rolls/buns}               => {whole milk}         0.015556685  0.4526627 0.03436706 1.7715630   153
## [218] {whole milk,                                                                                        
##        yogurt}                   => {rolls/buns}         0.015556685  0.2776770 0.05602440 1.5096478   153
## [219] {whole milk,                                                                                        
##        rolls/buns}               => {yogurt}             0.015556685  0.2746858 0.05663447 1.9690488   153
## [220] {other vegetables,                                                                                  
##        yogurt}                   => {whole milk}         0.022267412  0.5128806 0.04341637 2.0072345   219
## [221] {whole milk,                                                                                        
##        yogurt}                   => {other vegetables}   0.022267412  0.3974592 0.05602440 2.0541308   219
## [222] {other vegetables,                                                                                  
##        whole milk}               => {yogurt}             0.022267412  0.2975543 0.07483477 2.1329789   219
## [223] {other vegetables,                                                                                  
##        rolls/buns}               => {whole milk}         0.017895272  0.4200477 0.04260295 1.6439194   176
## [224] {whole milk,                                                                                        
##        rolls/buns}               => {other vegetables}   0.017895272  0.3159785 0.05663447 1.6330258   176
inspect(sort(rules, by = 'lift')[1:10])
##      lhs                                  rhs                  support    
## [1]  {berries}                         => {whipped/sour cream} 0.009049314
## [2]  {tropical fruit,other vegetables} => {pip fruit}          0.009456024
## [3]  {pip fruit,other vegetables}      => {tropical fruit}     0.009456024
## [4]  {citrus fruit,other vegetables}   => {root vegetables}    0.010371124
## [5]  {tropical fruit,other vegetables} => {root vegetables}    0.012302999
## [6]  {tropical fruit,other vegetables} => {citrus fruit}       0.009049314
## [7]  {beef}                            => {root vegetables}    0.017386884
## [8]  {citrus fruit,root vegetables}    => {other vegetables}   0.010371124
## [9]  {tropical fruit,root vegetables}  => {other vegetables}   0.012302999
## [10] {citrus fruit,other vegetables}   => {tropical fruit}     0.009049314
##      confidence coverage   lift     count
## [1]  0.2721713  0.03324860 3.796886  89  
## [2]  0.2634561  0.03589222 3.482649  93  
## [3]  0.3618677  0.02613116 3.448613  93  
## [4]  0.3591549  0.02887646 3.295045 102  
## [5]  0.3427762  0.03589222 3.144780 121  
## [6]  0.2521246  0.03589222 3.046248  89  
## [7]  0.3313953  0.05246568 3.040367 171  
## [8]  0.5862069  0.01769192 3.029608 102  
## [9]  0.5845411  0.02104728 3.020999 121  
## [10] 0.3133803  0.02887646 2.986526  89

Eclat method

freq.itemsets <- eclat(Groceries, parameter=list(supp=0.075, maxlen=15))
## Eclat
## 
## parameter specification:
##  tidLists support minlen maxlen            target  ext
##     FALSE   0.075      1     15 frequent itemsets TRUE
## 
## algorithmic control:
##  sparse sort verbose
##       7   -2    TRUE
## 
## Absolute minimum support count: 737 
## 
## create itemset ... 
## set transactions ...[169 item(s), 9835 transaction(s)] done [0.00s].
## sorting and recoding items ... [16 item(s)] done [0.00s].
## creating sparse bit matrix ... [16 row(s), 9835 column(s)] done [0.00s].
## writing  ... [16 set(s)] done [0.00s].
## Creating S4 object  ... done [0.00s].

sorting

inspect(sort(freq.itemsets, by = 'support')[1:10])
##      items              support    transIdenticalToItemsets count
## [1]  {whole milk}       0.25551601 2513                     2513 
## [2]  {other vegetables} 0.19349263 1903                     1903 
## [3]  {rolls/buns}       0.18393493 1809                     1809 
## [4]  {soda}             0.17437722 1715                     1715 
## [5]  {yogurt}           0.13950178 1372                     1372 
## [6]  {bottled water}    0.11052364 1087                     1087 
## [7]  {root vegetables}  0.10899847 1072                     1072 
## [8]  {tropical fruit}   0.10493137 1032                     1032 
## [9]  {shopping bags}    0.09852567  969                      969 
## [10] {sausage}          0.09395018  924                      924