I will be grateful if somebody could tell me what am I missing in my code. I am trying to find association rules using apriori algorithm (arules package) in R. I am using R-3.2 version for MacOSX.
The problem arises when I am reading the dataset from a csv format into a transactions class object. I am using the following piece of code -
>Transac1 <- read.transactions(file="transactions.csv", format = "basket", sep=";", rm.duplicates=TRUE)
On inspecting the data frame, I am observing that the first element in all the rows is missing.
>inspect(Transac1[1:5])
items
1 {,
Milk}
2 {,
Shoes}
3 {,
Talc}
4 {,
Cable}
5 {,
Shoe Polish, Talc}
I am able to generate association rules in the end, but I think those are not correct (just because of these blank elements). Can anyone understand and tell me what is possibly the reason for this? The file that I use for reading has data in the requisite format for apriori algorithm.
Any leads would be highly appreciated.
@user2031612 please write your code when run apriori algorithm in R, because i have meet same problem because, it's my mistake when not set
minLen
parameter, you should tried put parameterminLen = 2
. It will produce rule with no blank elements