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
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 
## 2159 1643 1299 1005  855  645  545  438  350  246  182  117   78   77   55 
##   16   17   18   19   20   21   22   23   24   26   27   28   29   32 
##   46   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
rules <- apriori(Groceries, parameter=list(support=0.01, confidence=0.5))
## Apriori
## 
## Parameter specification:
##  confidence minval smax arem  aval originalSupport maxtime support minlen
##         0.5    0.1    1 none FALSE            TRUE       5    0.01      1
##  maxlen target   ext
##      10  rules FALSE
## 
## Algorithmic control:
##  filter tree heap memopt load sort verbose
##     0.1 TRUE TRUE  FALSE TRUE    2    TRUE
## 
## Absolute minimum support count: 98 
## 
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[169 item(s), 9835 transaction(s)] done [0.01s].
## sorting and recoding items ... [88 item(s)] done [0.00s].
## creating transaction tree ... done [0.01s].
## checking subsets of size 1 2 3 4 done [0.01s].
## writing ... [15 rule(s)] done [0.00s].
## creating S4 object  ... done [0.00s].
summary(rules)
## set of 15 rules
## 
## rule length distribution (lhs + rhs):sizes
##  3 
## 15 
## 
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##       3       3       3       3       3       3 
## 
## summary of quality measures:
##     support          confidence          lift      
##  Min.   :0.01007   Min.   :0.5000   Min.   :1.984  
##  1st Qu.:0.01174   1st Qu.:0.5151   1st Qu.:2.036  
##  Median :0.01230   Median :0.5245   Median :2.203  
##  Mean   :0.01316   Mean   :0.5411   Mean   :2.299  
##  3rd Qu.:0.01403   3rd Qu.:0.5718   3rd Qu.:2.432  
##  Max.   :0.02227   Max.   :0.5862   Max.   :3.030  
## 
## mining info:
##       data ntransactions support confidence
##  Groceries          9835    0.01        0.5
inspect(head(sort(rules, by ="lift"),10))
##      lhs                     rhs                   support confidence     lift
## [1]  {citrus fruit,                                                           
##       root vegetables}    => {other vegetables} 0.01037112  0.5862069 3.029608
## [2]  {tropical fruit,                                                         
##       root vegetables}    => {other vegetables} 0.01230300  0.5845411 3.020999
## [3]  {root vegetables,                                                        
##       rolls/buns}         => {other vegetables} 0.01220132  0.5020921 2.594890
## [4]  {root vegetables,                                                        
##       yogurt}             => {other vegetables} 0.01291307  0.5000000 2.584078
## [5]  {curd,                                                                   
##       yogurt}             => {whole milk}       0.01006609  0.5823529 2.279125
## [6]  {other vegetables,                                                       
##       butter}             => {whole milk}       0.01148958  0.5736041 2.244885
## [7]  {tropical fruit,                                                         
##       root vegetables}    => {whole milk}       0.01199797  0.5700483 2.230969
## [8]  {root vegetables,                                                        
##       yogurt}             => {whole milk}       0.01453991  0.5629921 2.203354
## [9]  {other vegetables,                                                       
##       domestic eggs}      => {whole milk}       0.01230300  0.5525114 2.162336
## [10] {yogurt,                                                                 
##       whipped/sour cream} => {whole milk}       0.01087951  0.5245098 2.052747
plot(rules, method="graph")

itemFrequencyPlot(Groceries,topN=20,type="absolute")

plot(rules[1:5],method="graph",interactive = F)

plot(rules[1:15],method="graph",interactive = T)
itemFrequencyPlot(Groceries,topN=20,type="absolute")

library(rattle)
## Rattle: A free graphical interface for data mining with R.
## Version 4.1.0 Copyright (c) 2006-2015 Togaware Pty Ltd.
## Type 'rattle()' to shake, rattle, and roll your data.
ls()
## [1] "Groceries" "rules"
# 
# setwd("C:/Users/Dell/Desktop")
# dir(pattern = 'csv')
# dvd=read.csv("dvd.csv")
# 
# dvdrules <- apriori(dvd[,2], parameter=list(support=0.01, confidence=0.5))

library(arules)
a=read.transactions("http://fimi.ua.ac.be/data/retail.dat")
## Warning in rm(list = cmd, envir = .tkplot.env): object 'tkp.1' not found
itemFrequencyPlot(a,topN=20,type="absolute")

basket_rules <- apriori(a,parameter = list(sup = 0.01, conf = 0.01,target="rules"))
## Apriori
## 
## Parameter specification:
##  confidence minval smax arem  aval originalSupport maxtime support minlen
##        0.01    0.1    1 none FALSE            TRUE       5    0.01      1
##  maxlen target   ext
##      10  rules FALSE
## 
## Algorithmic control:
##  filter tree heap memopt load sort verbose
##     0.1 TRUE TRUE  FALSE TRUE    2    TRUE
## 
## Absolute minimum support count: 881 
## 
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[16470 item(s), 88162 transaction(s)] done [0.51s].
## sorting and recoding items ... [70 item(s)] done [0.02s].
## creating transaction tree ... done [0.11s].
## checking subsets of size 1 2 3 4 done [0.01s].
## writing ... [285 rule(s)] done [0.00s].
## creating S4 object  ... done [0.01s].
inspect(basket_rules)[1:10,]
##       lhs            rhs     support    confidence lift     
## [1]   {}          => {242}   0.01033325 0.01033325 1.0000000
## [2]   {}          => {45}    0.01033325 0.01033325 1.0000000
## [3]   {}          => {37}    0.01218212 0.01218212 1.0000000
## [4]   {}          => {161}   0.01145618 0.01145618 1.0000000
## [5]   {}          => {286}   0.01341848 0.01341848 1.0000000
## [6]   {}          => {175}   0.01100247 0.01100247 1.0000000
## [7]   {}          => {264}   0.01015177 0.01015177 1.0000000
## [8]   {}          => {2958}  0.01025385 0.01025385 1.0000000
## [9]   {}          => {13041} 0.01192124 0.01192124 1.0000000
## [10]  {}          => {31}    0.01043533 0.01043533 1.0000000
## [11]  {}          => {740}   0.01339579 0.01339579 1.0000000
## [12]  {}          => {956}   0.01033325 0.01033325 1.0000000
## [13]  {}          => {16217} 0.01322565 0.01322565 1.0000000
## [14]  {}          => {15832} 0.01296477 0.01296477 1.0000000
## [15]  {}          => {479}   0.01050339 0.01050339 1.0000000
## [16]  {}          => {78}    0.01202332 0.01202332 1.0000000
## [17]  {}          => {522}   0.01104784 0.01104784 1.0000000
## [18]  {}          => {258}   0.01119530 0.01119530 1.0000000
## [19]  {}          => {19}    0.01139947 0.01139947 1.0000000
## [20]  {}          => {179}   0.01132007 0.01132007 1.0000000
## [21]  {}          => {10515} 0.01000431 0.01000431 1.0000000
## [22]  {}          => {3270}  0.01077562 0.01077562 1.0000000
## [23]  {}          => {49}    0.01270389 0.01270389 1.0000000
## [24]  {}          => {589}   0.01269254 0.01269254 1.0000000
## [25]  {}          => {677}   0.01259046 0.01259046 1.0000000
## [26]  {}          => {16010} 0.01492707 0.01492707 1.0000000
## [27]  {}          => {1004}  0.01249972 0.01249972 1.0000000
## [28]  {}          => {783}   0.01094576 0.01094576 1.0000000
## [29]  {}          => {12925} 0.01663982 0.01663982 1.0000000
## [30]  {}          => {824}   0.01372473 0.01372473 1.0000000
## [31]  {}          => {548}   0.01289671 0.01289671 1.0000000
## [32]  {}          => {1146}  0.01617477 0.01617477 1.0000000
## [33]  {}          => {117}   0.01163767 0.01163767 1.0000000
## [34]  {}          => {592}   0.01391756 0.01391756 1.0000000
## [35]  {}          => {1393}  0.01316894 0.01316894 1.0000000
## [36]  {}          => {249}   0.01315760 0.01315760 1.0000000
## [37]  {}          => {338}   0.01445067 0.01445067 1.0000000
## [38]  {}          => {123}   0.01476827 0.01476827 1.0000000
## [39]  {}          => {604}   0.01371339 0.01371339 1.0000000
## [40]  {}          => {301}   0.01365668 0.01365668 1.0000000
## [41]  {}          => {14098} 0.01464350 0.01464350 1.0000000
## [42]  {}          => {79}    0.01814841 0.01814841 1.0000000
## [43]  {}          => {201}   0.01285134 0.01285134 1.0000000
## [44]  {}          => {1327}  0.02025816 0.02025816 1.0000000
## [45]  {}          => {438}   0.02113155 0.02113155 1.0000000
## [46]  {}          => {60}    0.01688936 0.01688936 1.0000000
## [47]  {}          => {255}   0.01671922 0.01671922 1.0000000
## [48]  {}          => {533}   0.01686668 0.01686668 1.0000000
## [49]  {}          => {185}   0.01560763 0.01560763 1.0000000
## [50]  {}          => {270}   0.01966834 0.01966834 1.0000000
## [51]  {}          => {9}     0.01556226 0.01556226 1.0000000
## [52]  {}          => {2238}  0.01945283 0.01945283 1.0000000
## [53]  {}          => {110}   0.03169166 0.03169166 1.0000000
## [54]  {}          => {147}   0.02017876 0.02017876 1.0000000
## [55]  {}          => {271}   0.02375173 0.02375173 1.0000000
## [56]  {}          => {413}   0.02132438 0.02132438 1.0000000
## [57]  {}          => {36}    0.03330233 0.03330233 1.0000000
## [58]  {}          => {475}   0.02457975 0.02457975 1.0000000
## [59]  {}          => {170}   0.03515120 0.03515120 1.0000000
## [60]  {}          => {101}   0.02537374 0.02537374 1.0000000
## [61]  {}          => {310}   0.02942311 0.02942311 1.0000000
## [62]  {}          => {237}   0.03439123 0.03439123 1.0000000
## [63]  {}          => {225}   0.03694335 0.03694335 1.0000000
## [64]  {}          => {89}    0.04352215 0.04352215 1.0000000
## [65]  {}          => {65}    0.05072480 0.05072480 1.0000000
## [66]  {}          => {38}    0.17690161 0.17690161 1.0000000
## [67]  {}          => {32}    0.17203557 0.17203557 1.0000000
## [68]  {}          => {41}    0.16951748 0.16951748 1.0000000
## [69]  {}          => {48}    0.47792700 0.47792700 1.0000000
## [70]  {}          => {39}    0.57479413 0.57479413 1.0000000
## [71]  {37}        => {38}    0.01186452 0.97392924 5.5054853
## [72]  {38}        => {37}    0.01186452 0.06706848 5.5054853
## [73]  {286}       => {38}    0.01265852 0.94336433 5.3327062
## [74]  {38}        => {286}   0.01265852 0.07155681 5.3327062
## [75]  {12925}     => {39}    0.01063950 0.63940014 1.1123985
## [76]  {39}        => {12925} 0.01063950 0.01851011 1.1123985
## [77]  {1146}      => {39}    0.01114993 0.68934081 1.1992830
## [78]  {39}        => {1146}  0.01114993 0.01939813 1.1992830
## [79]  {79}        => {48}    0.01012908 0.55812500 1.1678039
## [80]  {48}        => {79}    0.01012908 0.02119378 1.1678039
## [81]  {79}        => {39}    0.01260180 0.69437500 1.2080412
## [82]  {39}        => {79}    0.01260180 0.02192403 1.2080412
## [83]  {1327}      => {48}    0.01097979 0.54199328 1.1340504
## [84]  {48}        => {1327}  0.01097979 0.02297377 1.1340504
## [85]  {1327}      => {39}    0.01311223 0.64725644 1.1260665
## [86]  {39}        => {1327}  0.01311223 0.02281204 1.1260665
## [87]  {438}       => {48}    0.01162632 0.55018787 1.1511965
## [88]  {48}        => {438}   0.01162632 0.02432657 1.1511965
## [89]  {438}       => {39}    0.01429187 0.67632850 1.1766448
## [90]  {39}        => {438}   0.01429187 0.02486433 1.1766448
## [91]  {60}        => {39}    0.01114993 0.66017461 1.1485410
## [92]  {39}        => {60}    0.01114993 0.01939813 1.1485410
## [93]  {255}       => {48}    0.01198929 0.71709634 1.5004307
## [94]  {48}        => {255}   0.01198929 0.02508603 1.5004307
## [95]  {255}       => {39}    0.01198929 0.71709634 1.2475707
## [96]  {39}        => {255}   0.01198929 0.02085841 1.2475707
## [97]  {533}       => {39}    0.01045802 0.62004035 1.0787173
## [98]  {39}        => {533}   0.01045802 0.01819438 1.0787173
## [99]  {270}       => {48}    0.01085502 0.55190311 1.1547854
## [100] {48}        => {270}   0.01085502 0.02271271 1.1547854
## [101] {270}       => {39}    0.01354325 0.68858131 1.1979616
## [102] {39}        => {270}   0.01354325 0.02356191 1.1979616
## [103] {2238}      => {48}    0.01083233 0.55685131 1.1651388
## [104] {48}        => {2238}  0.01083233 0.02266524 1.1651388
## [105] {2238}      => {39}    0.01459813 0.75043732 1.3055758
## [106] {39}        => {2238}  0.01459813 0.02539714 1.3055758
## [107] {110}       => {38}    0.03090901 0.97530422 5.5132579
## [108] {38}        => {110}   0.03090901 0.17472429 5.5132579
## [109] {110}       => {48}    0.01565300 0.49391553 1.0334539
## [110] {48}        => {110}   0.01565300 0.03275187 1.0334539
## [111] {110}       => {39}    0.01995191 0.62956335 1.0952849
## [112] {39}        => {110}   0.01995191 0.03471140 1.0952849
## [113] {147}       => {48}    0.01175109 0.58234963 1.2184908
## [114] {48}        => {147}   0.01175109 0.02458763 1.2184908
## [115] {147}       => {39}    0.01289671 0.63912310 1.1119165
## [116] {39}        => {147}   0.01289671 0.02243710 1.1119165
## [117] {271}       => {48}    0.01236360 0.52053486 1.0891514
## [118] {48}        => {271}   0.01236360 0.02586923 1.0891514
## [119] {271}       => {39}    0.01626551 0.68481375 1.1914070
## [120] {39}        => {271}   0.01626551 0.02829798 1.1914070
## [121] {413}       => {48}    0.01287403 0.60372340 1.2632126
## [122] {48}        => {413}   0.01287403 0.02693723 1.2632126
## [123] {413}       => {39}    0.01281731 0.60106383 1.0457028
## [124] {39}        => {413}   0.01281731 0.02229896 1.0457028
## [125] {36}        => {38}    0.03164629 0.95027248 5.3717570
## [126] {38}        => {36}    0.03164629 0.17889202 5.3717570
## [127] {36}        => {48}    0.01606134 0.48228883 1.0091266
## [128] {48}        => {36}    0.01606134 0.03360627 1.0091266
## [129] {36}        => {39}    0.02310519 0.69380109 1.2070428
## [130] {39}        => {36}    0.02310519 0.04019734 1.2070428
## [131] {475}       => {48}    0.01619745 0.65897554 1.3788205
## [132] {48}        => {475}   0.01619745 0.03389106 1.3788205
## [133] {475}       => {39}    0.01701413 0.69220120 1.2042593
## [134] {39}        => {475}   0.01701413 0.02960039 1.2042593
## [135] {170}       => {38}    0.03437989 0.97805744 5.5288215
## [136] {38}        => {170}   0.03437989 0.19434470 5.5288215
## [137] {170}       => {48}    0.01766067 0.50242014 1.0512487
## [138] {48}        => {170}   0.01766067 0.03695265 1.0512487
## [139] {170}       => {39}    0.02335473 0.66440787 1.1559058
## [140] {39}        => {170}   0.02335473 0.04063148 1.1559058
## [141] {101}       => {48}    0.01487035 0.58605275 1.2262391
## [142] {48}        => {101}   0.01487035 0.03111428 1.2262391
## [143] {101}       => {39}    0.01587986 0.62583818 1.0888041
## [144] {39}        => {101}   0.01587986 0.02762704 1.0888041
## [145] {310}       => {48}    0.01919194 0.65227448 1.3647994
## [146] {48}        => {310}   0.01919194 0.04015664 1.3647994
## [147] {310}       => {39}    0.02100678 0.71395528 1.2421061
## [148] {39}        => {310}   0.02100678 0.03654662 1.2421061
## [149] {237}       => {48}    0.01907851 0.55474934 1.1607407
## [150] {48}        => {237}   0.01907851 0.03991931 1.1607407
## [151] {237}       => {39}    0.02188018 0.63621372 1.1068549
## [152] {39}        => {237}   0.02188018 0.03806611 1.1068549
## [153] {225}       => {48}    0.01969102 0.53300583 1.1152453
## [154] {48}        => {225}   0.01969102 0.04120090 1.1152453
## [155] {225}       => {39}    0.02666682 0.72182990 1.2558060
## [156] {39}        => {225}   0.02666682 0.04639369 1.2558060
## [157] {89}        => {48}    0.03173703 0.72921553 1.5257885
## [158] {48}        => {89}    0.03173703 0.06640560 1.5257885
## [159] {89}        => {39}    0.03118123 0.71644514 1.2464378
## [160] {39}        => {89}    0.03118123 0.05424766 1.2464378
## [161] {65}        => {41}    0.01128604 0.22249553 1.3125226
## [162] {41}        => {65}    0.01128604 0.06657745 1.3125226
## [163] {65}        => {48}    0.02868583 0.56551878 1.1832744
## [164] {48}        => {65}    0.02868583 0.06002136 1.1832744
## [165] {65}        => {39}    0.03161226 0.62321109 1.0842336
## [166] {39}        => {65}    0.03161226 0.05499753 1.0842336
## [167] {38}        => {32}    0.03213403 0.18164914 1.0558813
## [168] {32}        => {38}    0.03213403 0.18678710 1.0558813
## [169] {38}        => {41}    0.04420272 0.24987176 1.4740177
## [170] {41}        => {38}    0.04420272 0.26075611 1.4740177
## [171] {38}        => {48}    0.09010685 0.50936137 1.0657723
## [172] {48}        => {38}    0.09010685 0.18853685 1.0657723
## [173] {38}        => {39}    0.11734080 0.66331111 1.1539977
## [174] {39}        => {38}    0.11734080 0.20414406 1.1539977
## [175] {32}        => {41}    0.03625145 0.21072064 1.2430615
## [176] {41}        => {32}    0.03625145 0.21385079 1.2430615
## [177] {32}        => {48}    0.09112770 0.52970264 1.1083338
## [178] {48}        => {32}    0.09112770 0.19067284 1.1083338
## [179] {32}        => {39}    0.09590300 0.55746028 0.9698434
## [180] {39}        => {32}    0.09590300 0.16684756 0.9698434
## [181] {41}        => {48}    0.10228897 0.60341251 1.2625621
## [182] {48}        => {41}    0.10228897 0.21402634 1.2625621
## [183] {41}        => {39}    0.12946621 0.76373369 1.3287082
## [184] {39}        => {41}    0.12946621 0.22523927 1.3287082
## [185] {48}        => {39}    0.33055058 0.69163403 1.2032726
## [186] {39}        => {48}    0.33055058 0.57507647 1.2032726
## [187] {110,38}    => {48}    0.01543749 0.49944954 1.0450331
## [188] {110,48}    => {38}    0.01543749 0.98623188 5.5750305
## [189] {38,48}     => {110}   0.01543749 0.17132427 5.4059736
## [190] {110,38}    => {39}    0.01973639 0.63853211 1.1108884
## [191] {110,39}    => {38}    0.01973639 0.98919841 5.5917998
## [192] {38,39}     => {110}   0.01973639 0.16819720 5.3073018
## [193] {110,48}    => {39}    0.01176244 0.75144928 1.3073364
## [194] {110,39}    => {48}    0.01176244 0.58953951 1.2335346
## [195] {39,48}     => {110}   0.01176244 0.03558438 1.1228311
## [196] {36,38}     => {48}    0.01542615 0.48745520 1.0199365
## [197] {36,48}     => {38}    0.01542615 0.96045198 5.4293003
## [198] {38,48}     => {36}    0.01542615 0.17119839 5.1407331
## [199] {36,38}     => {39}    0.02206166 0.69713262 1.2128388
## [200] {36,39}     => {38}    0.02206166 0.95483554 5.3975514
## [201] {38,39}     => {36}    0.02206166 0.18801353 5.6456571
## [202] {36,48}     => {39}    0.01265852 0.78813559 1.3711615
## [203] {36,39}     => {48}    0.01265852 0.54786451 1.1463351
## [204] {39,48}     => {36}    0.01265852 0.03829524 1.1499269
## [205] {475,48}    => {39}    0.01238629 0.76470588 1.3303996
## [206] {39,475}    => {48}    0.01238629 0.72800000 1.5232452
## [207] {39,48}     => {475}   0.01238629 0.03747169 1.5244943
## [208] {170,38}    => {48}    0.01744516 0.50742329 1.0617172
## [209] {170,48}    => {38}    0.01744516 0.98779705 5.5838781
## [210] {38,48}     => {170}   0.01744516 0.19360524 5.5077847
## [211] {170,38}    => {39}    0.02290102 0.66611679 1.1588789
## [212] {170,39}    => {38}    0.02290102 0.98057309 5.5430421
## [213] {38,39}     => {170}   0.02290102 0.19516675 5.5522074
## [214] {170,48}    => {39}    0.01367936 0.77456647 1.3475546
## [215] {170,39}    => {48}    0.01367936 0.58572122 1.2255454
## [216] {39,48}     => {170}   0.01367936 0.04138357 1.1773018
## [217] {101,48}    => {39}    0.01073025 0.72158658 1.2553826
## [218] {101,39}    => {48}    0.01073025 0.67571429 1.4138441
## [219] {39,48}     => {101}   0.01073025 0.03246174 1.2793437
## [220] {310,48}    => {39}    0.01527869 0.79609929 1.3850164
## [221] {310,39}    => {48}    0.01527869 0.72732181 1.5218262
## [222] {39,48}     => {310}   0.01527869 0.04622195 1.5709404
## [223] {237,48}    => {39}    0.01411039 0.73959572 1.2867141
## [224] {237,39}    => {48}    0.01411039 0.64489373 1.3493561
## [225] {39,48}     => {237}   0.01411039 0.04268753 1.2412329
## [226] {225,48}    => {39}    0.01587986 0.80645161 1.4030269
## [227] {225,39}    => {48}    0.01587986 0.59549128 1.2459879
## [228] {39,48}     => {225}   0.01587986 0.04804063 1.3003862
## [229] {48,89}     => {39}    0.02410336 0.75947105 1.3212923
## [230] {39,89}     => {48}    0.02410336 0.77300837 1.6174193
## [231] {39,48}     => {89}    0.02410336 0.07291881 1.6754413
## [232] {48,65}     => {39}    0.02038293 0.71055753 1.2361948
## [233] {39,65}     => {48}    0.02038293 0.64477933 1.3491168
## [234] {39,48}     => {65}    0.02038293 0.06166358 1.2156495
## [235] {32,38}     => {48}    0.01867018 0.58100953 1.2156868
## [236] {38,48}     => {32}    0.01867018 0.20720040 1.2044044
## [237] {32,48}     => {38}    0.01867018 0.20487926 1.1581537
## [238] {32,38}     => {39}    0.02087067 0.64948818 1.1299492
## [239] {38,39}     => {32}    0.02087067 0.17786370 1.0338775
## [240] {32,39}     => {38}    0.02087067 0.21762271 1.2301906
## [241] {38,41}     => {48}    0.02692770 0.60918655 1.2746435
## [242] {38,48}     => {41}    0.02692770 0.29884189 1.7628972
## [243] {41,48}     => {38}    0.02692770 0.26325128 1.4881225
## [244] {38,41}     => {39}    0.03460675 0.78290993 1.3620702
## [245] {38,39}     => {41}    0.03460675 0.29492508 1.7397916
## [246] {39,41}     => {38}    0.03460675 0.26730331 1.5110281
## [247] {38,48}     => {39}    0.06921349 0.76812689 1.3363513
## [248] {38,39}     => {48}    0.06921349 0.58985017 1.2341847
## [249] {39,48}     => {38}    0.06921349 0.20938851 1.1836439
## [250] {32,41}     => {48}    0.02340010 0.64549437 1.3506129
## [251] {32,48}     => {41}    0.02340010 0.25678367 1.5147917
## [252] {41,48}     => {32}    0.02340010 0.22876469 1.3297523
## [253] {32,41}     => {39}    0.02675756 0.73811014 1.2841296
## [254] {32,39}     => {41}    0.02675756 0.27900651 1.6458863
## [255] {39,41}     => {32}    0.02675756 0.20667601 1.2013563
## [256] {32,48}     => {39}    0.06127356 0.67239233 1.1697968
## [257] {32,39}     => {48}    0.06127356 0.63891189 1.3368399
## [258] {39,48}     => {32}    0.06127356 0.18536820 1.0774992
## [259] {41,48}     => {39}    0.08355074 0.81681082 1.4210493
## [260] {39,41}     => {48}    0.08355074 0.64534782 1.3503063
## [261] {39,48}     => {41}    0.08355074 0.25276234 1.4910695
## [262] {110,38,48} => {39}    0.01169438 0.75753123 1.3179175
## [263] {110,38,39} => {48}    0.01169438 0.59252874 1.2397892
## [264] {110,39,48} => {38}    0.01169438 0.99421408 5.6201527
## [265] {38,39,48}  => {110}   0.01169438 0.16896100 5.3314028
## [266] {36,38,48}  => {39}    0.01225018 0.79411765 1.3815688
## [267] {36,38,39}  => {48}    0.01225018 0.55526992 1.1618300
## [268] {36,39,48}  => {38}    0.01225018 0.96774194 5.4705094
## [269] {38,39,48}  => {36}    0.01225018 0.17699115 5.3146777
## [270] {170,38,48} => {39}    0.01353191 0.77568270 1.3494966
## [271] {170,38,39} => {48}    0.01353191 0.59088658 1.2363532
## [272] {170,39,48} => {38}    0.01353191 0.98922056 5.5919251
## [273] {38,39,48}  => {170}   0.01353191 0.19550967 5.5619630
## [274] {32,38,48}  => {39}    0.01401965 0.75091130 1.3064004
## [275] {32,38,39}  => {48}    0.01401965 0.67173913 1.4055266
## [276] {38,39,48}  => {32}    0.01401965 0.20255654 1.1774108
## [277] {32,39,48}  => {38}    0.01401965 0.22880415 1.2933977
## [278] {38,41,48}  => {39}    0.02258343 0.83866891 1.4590770
## [279] {38,39,41}  => {48}    0.02258343 0.65257293 1.3654239
## [280] {38,39,48}  => {41}    0.02258343 0.32628646 1.9247954
## [281] {39,41,48}  => {38}    0.02258343 0.27029595 1.5279451
## [282] {32,41,48}  => {39}    0.01867018 0.79786718 1.3880921
## [283] {32,39,41}  => {48}    0.01867018 0.69775329 1.4599579
## [284] {32,39,48}  => {41}    0.01867018 0.30470196 1.7974663
## [285] {39,41,48}  => {32}    0.01867018 0.22345914 1.2989124
##      lhs        rhs    support confidence lift
## [1]   {} =>   {242} 0.01033325 0.01033325    1
## [2]   {} =>    {45} 0.01033325 0.01033325    1
## [3]   {} =>    {37} 0.01218212 0.01218212    1
## [4]   {} =>   {161} 0.01145618 0.01145618    1
## [5]   {} =>   {286} 0.01341848 0.01341848    1
## [6]   {} =>   {175} 0.01100247 0.01100247    1
## [7]   {} =>   {264} 0.01015177 0.01015177    1
## [8]   {} =>  {2958} 0.01025385 0.01025385    1
## [9]   {} => {13041} 0.01192124 0.01192124    1
## [10]  {} =>    {31} 0.01043533 0.01043533    1
basket_rules<- sort(basket_rules, by="lift")
library(arulesViz)
plot(basket_rules[1:10,])

plot(basket_rules[1:10,], method="graph", control=list(type="items"))