My data table has the following format
ID Var1 Var2 Var3 ...
1_1 0 0 1 ...
1_2 1 1 0 ...
1_3 0 0 1 ...
... ... ... ... ...
I want to extract the ID's from unique combinations (Var
columns). Getting the unique combinations is not the problem (plyr::count()
, aggregate()
etc), I want to extract the id
variables contributing to these unique combinations.
The output should look somewhat like this
Var1 Var2 Var3 IDs
0 0 1 1_1, 1_3
1 1 0 1_2
where the IDs
column is a vector/list of all the ID's contributing to a unique combination.
I tried an R package and dplyr
pipelines, nothing worked so far.
Any suggestions or even R packages how to handle this task?
Thank you!