joran and DWin mentioned:
- Elements of character vectors in a_list are unique.
- There is a duplication in one of the vectors of b_list.
How it looks like. If I add the second "b" into the first vector of a_list2
> a_list2 <- list(
c("a","b","b","c"),
c("a","b"),
c("a","b","d"),
c("c","e"),
c("c","e"),
c("a","b","d","e")
)
in the following attempt to transform the data I get the error
> a_trans2 <- as(a_list2,"transaction")
Error in as(a_list2, "transaction") :
no method or default for coercing “list” to “transaction”
It appears that b_list has "Steady Whitening Toothpast" mentioned twice in the fourth vector. Manual removal of this duplication solved the issue.
> b_trans2 <- as(b_list2,"transactions")
> summary(b_trans2)
transactions as itemMatrix in sparse format with
6 rows (elements/itemsets/transactions) and
... and so on ...
2 Best Choice Mini Donuts
3 Better Beef Soup
Speaking about the solution for the real data processing, the following code delivers no errors.
aggrData <- split(selData$product_name,selData$transaction_id)
listData <- list()
for (i in 1:length(aggrData)) {
listData[[i]] <- as.character(aggrData[[i]][!duplicated(aggrData[[i]])])
}
trnsData <- as(listData,"transactions")
Though, the following line nor attempts with other parameters deliver no rules.
> rules <- apriori(trnsData)
parameter specification:
... and so on ...
writing ... [0 rule(s)] done [0.00s].
creating S4 object ... done [0.00s].
Yet this is a totally different story.