Pairwise comparison of dataframe rows in R
Hello family! I have a dataframe like this:
n
ame members
x1 A,B,N,K,Y,G
x2 J,L,M,N,T
x3 G,H,S,J,D,F
x4 J,K,H,F,H,D,L
I want to perform pairwise comparison to find the number of common elements between any two rows like below:
name common name
x1 6 x1
x1 2 x2
x1 - x3
x1 - x4
x2 - x1
x2 5 - x2
x2 - x3
x2 - x4
x3 - x1
x3 - x2
x3 6 - x3
x3 - x4
x4 - x1
x4 - x2
x4 - x3
x4 7 -x4
I notice that the exact orientation of the dataframe is not writable in this workspace, but treat former as a 4by1 matrix and the later as a 16by3 matrix
• 2,509 views
•
link
1 answer
Thank you guys, I got a solution here: https://stackoverflow.com/questions/57658909/pairwise-comparison-of-dataframe-row-elements
• 0 views
•
link
Log in to answer this question.
This doesn't look like a bioinformatics question, otherwise more context is required.
Oh, okay, let me be a bit specific. Treat the names as pathways and the members as genes. I am interested in the number of common genes in any two pathways compared
Hello odongoregan!
We believe that this post does not fit the main topic of this site.
Cross-posted, and got a solution there.
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!