Search code examples
rversionarules

Packages for market basket analysis in R 3.3.0


I want to go for market basket analysis on my products data but I'm bound to use R 3.3.0 version. I am aware of the package 'arules' but it works for R >=3.4.0. I have around 20 columns, each of them representing a product and the cells contain 0 or 1 depending on whether a customer has bought a product. How can I convert these columns into transactions in order to use package 'arulesNBMiner'. Also, is there any other package that can be used in my case?


Solution

  • One option is to convert it to a list and then use as

    as(as.list(df1), "transactions")
    

    data

    set.seed(24)
    df1 <- as.data.frame(matrix(sample(0:1, 10 * 20, replace = TRUE), ncol = 20))