[BioC] Extracting elements from a table with VennCounts

lcarvalh at btk.fi lcarvalh at btk.fi
Tue Apr 17 11:19:44 CEST 2012



I have a table in this format that comes from the function vennCounts:

      c1 c2 c3 c4 Counts
 [1,]  0  0  0  0     26
 [2,]  0  0  0  1     27
 [3,]  0  0  1  0      4
 [4,]  0  0  1  1      6
 [5,]  0  1  0  0      5
 [6,]  0  1  0  1     12
 [7,]  0  1  1  0     42
 [8,]  0  1  1  1     78
 [9,]  1  0  0  0     18
[10,]  1  0  0  1     52
[11,]  1  0  1  0      4
[12,]  1  0  1  1     63
[13,]  1  1  0  0     13
[14,]  1  1  0  1     47
[15,]  1  1  1  0     88
[16,]  1  1  1  1    182
attr(,"class")
[1] "VennCounts"


I am trying to write a R script that will "extract" from the table for example
the cases that have c2==1, (c2 and c3)== 1, (c2 and c4)==1, (c1 and c2 and
c3)==1, and so on ... so that in the end I will have a list that has the Counts
value for each case.

Example list for columns that have c2 == 1: C2<-c(4, 42, 12, ...)

I tried to it on this way: totalC2<-table[table[c1]], also if I use table$c1 ==
1 it is not working.

Can anyone give-me a suggestion how to solve this problem?

Thank you,

Leonor



More information about the Bioconductor mailing list