I have a dataframe that contains:
userID song sex
1 songA M
2 songB F
1 songC M
2 songA F
... ... ...
So each line is a register of a song listened by the user.
I want to use "arules" but first I need to transform this dataframe to a transaction. I've searched a lot but actually I'don't know if my idea is wrong because I have no answer yet.
I've find solutions like using split to create lists of lists with all songs listend by each user, but if I do that I'll lose the sex information. I'll only get rules like {songA,songB} -> {songZ}
.
I want to generate rules like {songA,songC,M} -> {songZ}
(using the sex information). I don't know if I am wrong with my idea and this is not possible.
Any idea?
Thanks.