pingu
pingu

Reputation: 31

calculate overlap in R

:) I am using R and I have several file, each of those are like this:

  ID_A ID_B
  1   AA
  2   AB
  3   AA
  1   AF
  5   AA
  6   AB
 ...  ... 

I don't know in advance how many ID are presented in each file (the amounts changed in each file), the column are always the same. I would like to calculate the overlap among ID_A and ID_B and obtained a file like this:

12356 0
1235  0
1236  0
1356  0
1256  0
...   ...
123   0
156   0
135   AA
235   0
236   0
...   ...
13    AA
26    AB
...  ...

Therefore, what I would like to obtained is the output of the function:

calculate.overlap

of R. But the problem is to "traduce" the names of the object reported in the output list(a1,a2,a3...).

I have already read this post: The output order of function calculate.overlap

But I didn't understand how fix the problem... I am wondering if exist another solution or another function that can help me.

Thank you in advance for your help!

Upvotes: 2

Views: 1114

Answers (1)

pingu
pingu

Reputation: 31

I have found a solution: using gplot package and with this command it is possibile to obtained the intersection with the "name":

library(gplots) 
output <- venn(data=file_list,show.plot = FALSE)

Upvotes: 1

Related Questions