I have been working on a dataset which is represented in the following way:
P1 P2 P3 P4 P5
0 2 1 0 1
0 1 0 0 0
0 0 0 3 0
0 0 0 1 1
0 0 5 0 0
1 1 0 0 0
I am trying to convert it in to a row in R where there dummy variable is not 0, for example:
P2,P3,P5
P2
P4
P4,P5
P3
P1,P2
I tried the following: Recoding dummy variable to ordered factor , however, I am not getting multiple items. I am happy to generate a new transaction table which doesn't have any column names. I am hoping to run market basket analysis for the generated dataset.
Thanks