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?
Asked
Active
Viewed 201 times
1 Answers
0
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))

akrun
- 874,273
- 37
- 540
- 662
-
Yes, I tried that. It gives an error- no method or default for coercing “list” to “transactions” – Renuka Deshpande Feb 21 '18 at 06:10
-
@RenukaDeshpande It is working for me. The `arulesNBMiner` loads `arules` package – akrun Feb 21 '18 at 06:10
-
@RenukaDeshpande Try to install the `arules` by `library(versions); install.versions('arules', '1.5-5')` – akrun Feb 21 '18 at 06:12
-
It loads arulesNBMiner, but not arules for me. It says- Loading required package: arules Error: This is R 3.3.0, package ‘arules’ needs >= 3.4.0 In addition: Warning message: package ‘arulesNBMiner’ was built under R version 3.3.3 – Renuka Deshpande Feb 21 '18 at 06:13
-
@RenukaDeshpande I think the arules is not loaded bcz you have a previous R version. One option is to update to new R version. If that is not possible, install the package `versions` and then do `install.versions('arules', '1.5-5')` – akrun Feb 21 '18 at 06:14
-
install_version('arules' , '1.5-5') is also not working. – Renuka Deshpande Feb 21 '18 at 06:17
-
@RenukaDeshpande It should be `install.versions` – akrun Feb 21 '18 at 06:22
-
It was installed with a warning that package ‘arules’ is not available for R version 3.3.0. Is there any package other than arules that can be used for market basket analysis? – Renuka Deshpande Feb 21 '18 at 06:31
-
@RenukaDeshpande If 1.5-5` is not available, then try for the earlier version i.e. `1.5-4` – akrun Feb 21 '18 at 06:32
-
@RenukaDeshpande Have you tried that? – akrun Feb 21 '18 at 06:37
-
Tried that just now. Worked for the most basic version 1.1-6. Thanks a ton!! – Renuka Deshpande Feb 21 '18 at 06:44
-
1Yes, done that! :) – Renuka Deshpande Feb 21 '18 at 06:48