I have a data frame containing for each session (column "session") a sequence of actions (column "action"). Actions can be repeated within the same session (e.g. a->b->a for session 01), since what I am interested in is understanding the order in which they happen:
x<- data.frame(
session=c("01","01","01","02","02", "02","03","03"),
action=c("a","b","a","c","a","c", "a","b"))
I need to convert it into transactions format so that I can use 'arules' package to apply apriori algorithm for example. Desired output would be:
01 a,b,a
02 c,a,c
03 a,b
where basically for each session, the correspondent exact sequence is reported beside.
Which approach do you suggest?
Thank you.