Displaying 1 result from an estimated 1 matches for "tranaction_list".
2011 Mar 06
1
transaction list transformation to use rpart.
...lists using the read.transaction function in
arules
from data like
Customer-ID | Item-ID
cust1 | 2
cust1 | 3
cust1 | 5
cust2 | 5
cust2 | 3
cust3 | 2
...
#read in data to a sparse binary transaction matrix
txn = read.transactions(file="tranaction_list.txt", rm.duplicates= TRUE,
format="single",sep="|",cols =c(1,2));
#tranaction matrix to matrix
a<-as(txn, "matrix")
#matrix to data.frame
b<-as.data.frame(a)
I end up with a data.frame like:
X X.1 X.2 X.3 X.4 X.5 ...
cust1 0 1 1 0 1
cu...