Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201941

Grouping factors or integers into equivalence classes in R

$
0
0

I have a data frame representing equivalences between members from two sets:

 print(x)
    G  S
 1 g1 s2
 2 g1 s1
 3 g2 s3
 4 g3 s3
 5 g4 s3

Does someone know of a function or a useful data structure for grouping the objects into equivalence classes? In the example above, the result should be a two equivalence classes

{g1, s1, s2}, {g2, g3, g4, s3}

Viewing all articles
Browse latest Browse all 201941

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>