[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-help
Subject:    RE: [R] Finding common sets
From:       "Gabor Grothendieck" <ggrothendieck () myway ! com>
Date:       2003-10-30 20:43:17
[Download RAW message or body]


If A is the incidence matrix whose columns represent groups 
and whose rows represent elements then the i,j-th element of 
the cross product matrix, crossprod(A), is the number of 
common elements in group i and group j.

In your case A has the form cbind(A1,A2) and you only need 
the block cross diagonal elements, namely crossprod(A1,A2).


---
From: Sean Davis <sdavis2@mail.nih.gov>
To: r-help <r-help@stat.math.ethz.ch> 
Subject: [R] Finding common sets 

 
 
I am working on a problem in which I have 2 groups of clusters, each of
which was generated from the same original list of members. Within each
group, the clusters cover the original list of members many times over.
What I am interested in finding is the number of common elements in every
pair of clusters when taking one from each group. In short, I need a FAST
way of finding the number of common elements in two groups, as this process
will be over all pairs. (The elements in the two groups can be numeric if
absolutely necessary, but it would be nice to be general here.)

Thanks,
Sean

-- 
Clinical Fellow
National Institutes of Health
NCI/NHGRI


_______________________________________________
No banners. No pop-ups. No kidding.
Introducing My Way - http://www.myway.com


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic