Hi I have a sparse dataframe of grocery order like this
library(arules)
a_df <- data.frame(
apple = as.factor(c(1,0,0,0,1,1)),
banana = as.factor(c(0,1,1,0,0,0)),
peeler = as.factor(c(1,0,0,0,1,1)))
a_tran = as(a_df, "transactions" )
inspect(a_tran)
rules <- apriori(a_tran, parameter=list(minlen=2, supp=0.5,conf = 0.5))
inspect(rules)
However the result include 0s (the item not ordered) like this: lhs rhs support confidence lift count {banana=0} => {apple=1} 0.5 0.6 1.2 3
How can I ignore the 0s in the dataframe, or transform the dataframe to something like
order 1: apple, peeler
order 2: banana
Thanks.