R - Get all the product in chart

205 views Asked by At

I'm applying a Market Basket Analysis using R script. I have a big data set in the following format:

1   25  20  21  36  
2   45  23  17      
3   16  18  26  13  14
4   37  41          
5   15  17  25  

Where the first column is the ID of the Transaction and the others the products purchased.

I want to create a link analysis to identify which products are correlated. I've this R script:

library(arules)
library(arulesViz)
library(igraph)
library(iplots)

data <- read.transactions('data.csv', sep=',')


itemFrequencyPlot(data,
                  type="absolute",
                  topN=10, 
                  horiz=TRUE,
                  col='steelblue3',
                  xlab=',',
                  main='Item frequency, relative')

itemsets = apriori(data, list(supp=0.05,conf=0.3,minlen=2))

plot(itemsets, method="graph", 
     control=list(nodeCol="steelblue3", edgeCol="black", type="items"), shading="lift")

I'm getting the following images:

enter image description here

But what I'm trying to get is a map that contains all the products and based on the line that connect the nodes I can see the confidence between the products (I don't want the balls, I need lines).

Do you know how can I do that?

0

There are 0 answers