Re: [R] Support Counting

From: psombe <srinivas.eswar_at_gmail.com>
Date: Tue, 05 Apr 2011 08:43:34 -0500 (CDT)

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.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 05 Apr 2011 - 15:13:00 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 06 Apr 2011 - 08:30:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive