Perform the following steps to create transactions with temporal information:
- First, you need to install and load the arulesSequences package:
> install.packages("arulesSequences") > library(arulesSequences)
- You can first create a list with purchasing records:
> tmp_data=list(c("A"), + c("A","B","C"), + c("A","C"), + c("D"), + c("C","F"), + c("A","D"), + c("C"), + c("B","C"), + c("A","E"), + c("E","F"), + c("A","B"), + c("D","F"), + c("C"), + c("B"), + c("E"), + c("G"), + c("A","F"), + c("C"), + c("B"), + c("C"))
- You can then turn the list into transactions and add temporal information:
> names(tmp_data) = paste("Tr",c(1:20), sep = "") > trans = as(tmp_data,"transactions") > transactionInfo(trans)$sequenceID=c(1,1,1,1,1,2,2,2,2,3,3,3,3,3,4 ...