[R] Subsetting comparison problem

Neha Aggarwal aggarwalneha2000 at gmail.com
Mon Mar 12 01:38:29 CET 2018


Hello All,
I am facing a unique problem and am unable to find any help in R help pages
or online. I will appreciate your help for the following problem:
I have 2 data-frames, samples below and there is an expected output

R Dataframe1:
            C1              C2   C3         C4...... CN
R1       0                  1       0           1
R2        1                  0      1            1
R3        1                  0       0             0
.
.
.
RN

U Dataframe2 :
             C1         C2        C3         C4...... CN
U1         1           1            0            1
U2         1           1             1            1


Expected Output:
U1 satisfies R1, R3
U2 satisfies R1, R2, R3

So this is a comparison of dataframes problem, with a subset dimension.
There are 2 dataframe R and U. column names are same. There are certain
columns belonging to each row in dataframe 1, denoted as 1s, while there
are certain cols to each U denoted as 1s in each URow in dataframe2.

I have to find relationships between Rs and Us. So i start with each U row
in U dataframe (lets say U1 row) and try to find all the rows in R
dataframe, which are subset of U1 row.

I cant find a way to compare rows to see if one is subset of
another....what can I try, any pointers/ packages will be great help.
Please help.

Thanks
Neha

	[[alternative HTML version deleted]]



More information about the R-help mailing list