Off topic:Pairwise comparison of dataframe rows in R
1
0
Entering edit mode
4.7 years ago
OdongoR89 • 0

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

R dataframe pairwise intersect • 2.3k views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 2536 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6