David Hill
2009-Apr-24 22:26 UTC
[R] Calculate number of elements in a MECE intersection of x vectors where the total number of vectors is n
Is there a function, or code snippet that anyone is aware of that will give the number of elements in a MECE intersection of x vectors where the total number of vectors is n? I have several vectors, A, B, C, ....,n of varying length. I am trying to figure out a way to systematically calculate the number of MECE elements in all possible combinations of 2 vectors only, then do the same for 3 vectors, etc. For example, if I had just 3 vectors A, B and C, and I use the intersect function for each combination of 2 > length(intersect(A,B)) > length(intersect(A,C)) > length(intersect(B,C)) then each result could also potentially include elements from other vectors as well (i.e. > length(intersect(A,B)) includes elements from C as well). Any help or tips would be appreciated. Thanks, DMH [[alternative HTML version deleted]]