I have a data frame with many rows (>9000) and columns (148). The first column has a unique code for experiments, the other columns are populated with the name of the clones tested in the experiment. I want a matrix that has the number of common clones among each experiment (pairwise).
Example of my dataset:
Exp_No Clone1 Clone2 Clone3 Clone4
Exp1 Egxn2 Egxn11 Egxn6 Egxn13
Exp2 Egxn4 Egxn13 Egxn16 Egxn6
Exp3 Egxn2 Egxn6 Egxn11 Egxn18
Exp4 Egxn6 Egxn14 Egxn4 Egxn18
Exp5 Egxn2 Egxn11 Egxn6 Egxn13
Exp6 Egxn4 Egxn2 Egxn5 Egxn18
What I need:
Exp1 Exp2 2
Exp1 Exp3 3
Exp1 Exp4 1
Exp1 Exp5 4
Exp1 Exp6 1
Exp2 Exp3 1
Exp2 Exp4 2
...
and so on for all pairs of rows. Any suggestion? Thank you in advance, been on this for a few hours! I could not find a way to resolve this.