Ok, so I searched a lot and want to run arules according to sales data. I just need to get the data in the correct format correctly and set it up with the right “factors” or “variables” and in the form of a basket.
Now I have sales data with order #, and then the items inside this. Each order is unique (each new order, a new # is created and includes a part #), but the same elements can obviously be displayed in many orders.
My data is currently configured as follows:
Order # Part # PartDescription
1 A PartA
1 B PartB
1 G PartG
2 R PartR
3 A PartA
3 B PartB
4 E PartE
5 Y PartY
6 A PartA
6 B PartB
6 F PartF
6 V PartV
Therefore, R is not like in this form, and I have to get it in the form in which arules and data analysis will be accepted.
Yes I save it as a text file and tried the .csv file, but if I can get step-by-step instructions on how to prepare it or manage it in RStudio, that would be great.
I read that it should be in the shape of a basket, such as ..
1 (A, B, G)
2 (R)
3 (A, B)
4 (E)
5 (Y)
6 (A, B, F, V)
If it is not, please correct me. I get this idea, but I just need step-by-step instructions that I cannot find anywhere else. I tried using dplyr and tidyr. I am good at data analysis, but need more direct help from RStudio, so if I could just do it step by step, I will understand this further.
r arules market-basket-analysis
V1k1
source share