[R] Support Counting

psombe srinivas.eswar at gmail.com
Tue Apr 5 15:43:34 CEST 2011


well im using the "arules" package and i'm trying to use the support command.
my data is read form a file using the "read.transactions" command and a line
of data looks something like this. there are aboutt 88000 rows and 16000
different items
> inspect(dset[3])
  items
1 {33, 
    34, 
    35} 
> inspect(dset[1])
  items
1 {0, 1,  10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2,  20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 3, 4,5, 6, 7,  8,  9}  

So in order to use support i have to make an object of class "itemsets" and
im kind of struggling with the "new" command.
I made an object of class itemsets by first creating a presence/absence
matrix and with something like 16000 items this is really sort of tedious. I
wonder if there is a better way.

//Currently im doing this

avec = array(dim=400) //dim is till the max number of the item im concerned
with
avec[1:400] = 0
avec[27] = 1
avec[63] = 1 //and do on for all the items i want

amat = matrix(data = avec,ncol = 400)
aset = as(amat,"transactions") //coercing the matrix as a transactions class

then say my data is "dat" i can use

>support(aset,dat)
[1] 0.001406470


There has to be a better way
Thanks once again

--
View this message in context: http://r.789695.n4.nabble.com/Support-Counting-tp3424730p3428062.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list