Say I have:
df<-data.frame(ID=c(102, 102, 167,143,143,148,148 ),
ID2=c(167, 167, 102,148,148,143,143 ),
group=c(1,1,1,2,2,2,2))
ID ID2 group
1 102 167 1
2 102 167 1
3 167 102 1
4 143 148 2
5 143 148 2
6 148 143 2
7 148 143 2
usually I can use add_group_indices to group by ID and ID2, but in this case I want to group by the values within them (i.e. 102 always attaches to 167 and vice versa), same with 143 and 148. I want to identify these groupings by that group variable.