title: Assign group numbers across all combinations in two columns
body: <p>I have used pairwise cosine similarity to compare a bunch of company names and I have all the pairwise matches. I need to assign group numbers that take into account all the combinations, rather than just the first column. Some examples I found that used group_by() gave group numbers based solely on item1, not extending to the rows identified in item2.</p>
  <p>Sample data:
  <a href="https://i.stack.imgur.com/1bB4G.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>Desired output is:
  <a href="https://i.stack.imgur.com/wSZ0D.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>The output could also just be a column added to the sample data but with unique group numbers across all matched rows.</p>