I have a question that I think expands on Nick Cox's FAQ: https://www.stata.com/support/faqs/d...-to-all-pairs/
In short, I have a dataset with observations of objects belonging in either group 1 or group 2.
I would like to expand my dataset and identify all possible pairs of objects that cut across group 1 and group 2.
So, if we have a toy dataset:
group | id |
1 | 1 |
1 | 2 |
2 | 3 |
2 | 4 |
I would like to identify all possible pairs of objects cutting across groups like this:
group | id | id | dyadid |
1 | 1 | 3 | 1 |
1 | 1 | 4 | 2 |
1 | 2 | 3 | 3 |
1 | 2 | 4 | 4 |
2 | 3 | 1 | 1 |
2 | 3 | 2 | 3 |
2 | 4 | 1 | 2 |
2 | 4 | 2 | 4 |
Thanks!
Best,
Erik
0 Response to Expanding datasets to all possible pairs cutting across groups
Post a Comment