I'm dealing with the following issue. I would like to sum the count by Date, and unique pair of ID1 and ID2, meaning that A-B and B-A are ONE pair. However, I want to keep both pairs and their sum in my dataset.
My Dataset looks like this:
Date ID1 ID2 Count
12-1 A B 1
12-1 B A 1
12-1 D E 1
12-1 E D 2
12-2 Y Z 2
12-2 Z Y 3
An expected output looks like this:
Date ID1 ID2 SUM
12-1 A B 2
12-1 B A 2
12-1 D E 3
12-1 E D 3
12-2 Y Z 5
12-2 Z Y 5
My Question can be seen as an extension of this previous question:
R sum observations by unique column PAIRS (B-A and A-B) and NOT unique combinations (B-A or A-B)
Many thanks in advance.