mhahsler / arules

Mining Association Rules and Frequent Itemsets with R
http://mhahsler.github.io/arules
GNU General Public License v3.0
194 stars 42 forks source link

error in evaluating the argument 'x' in selecting a method for function 'colSums': 'NA' indices are not (yet?) supported for sparse Matrices #64

Closed javiercoh closed 3 years ago

javiercoh commented 3 years ago

The following code:

`df<-read.csv("df1.csv")

colnames(df) <- c("customer_id", "customer_size", "sku_nbr", "avg_ROS", "sku_id", "sku_amount", "sku_qty", "category_id", "city_id", "channel_id", "sector_id", "top_skus", "avg_sku_ros")

dataset <- as(split(df[,"sku_id"], df[,"customer_id"]), "transactions")

category <- df%>% select(sku_id, category_id) %>% distinct()

itemInfo(dataset) <- data.frame(labels = category$sku_id, category_id = category$category_id)

dataset <- addAggregate(dataset, "category_id")

rules <- apriori(dataset, parameter = list(support=0.15, conf=.3, minlen=2, maxlen=15))    

rules <- subset(rules, subset=lift>1)

rules <- filterAggregate(rules)

`

throws:

error in evaluating the argument 'x' in selecting a method for function 'colSums': 'NA' indices are not (yet?) supported for sparse Matrices at rules <- filterAggregate(rules) Repo here

Is this an issue with filterAggregate?

mhahsler commented 3 years ago

I cannot run your code since I do not have dataframe1.

javiercoh commented 3 years ago

I cannot run your code since I do not have dataframe1.

Sorry, just updated the code replacing dataframe1 with df

mhahsler commented 3 years ago

Hi, I have confirmed the bug. I have fixed it in the version on GitHub and a fixed version will be released on CRAN soon. Thank you for helping to improve arules by reporting bugs.

Regards, -MFH

javiercoh commented 3 years ago

Hi, I have confirmed the bug. I have fixed it in the version on GitHub and a fixed version will be released on CRAN soon. Thank you for helping to improve arules by reporting bugs.

Regards, -MFH

thank you for this amazing library!