I have a relational dataset, where I'm looking for dyadic information.
I have 4 columns. Sender, Receiver, Attribute, Edge
I'm looking to take the repeated Sender -- Receiver counts and convert them as additional edges.
df <- data.frame(sender = c(1,1,1,1,3,5), receiver = c(1,2,2,2,4,5), 
                attribute = c(12,12,12,12,13,13), edge = c(0,1,1,1,1,0))
   sender receiver attribute edge
1       1        1        12    0
2       1        2        12    1
3       1        2        12    1
4       1        2        12    1
5       3        4        13    1
I want the end result to look like this:
  sender receiver attribute edge
1      1        1        12    0
2      1        2        12    3
3      3        4        13    1
Where the relationship between duplicate sender-receivers have been combined and the number of duplicates incorporated in the number of edges.
Any input would be really appreciated.
Thanks!
 
     
     
     
    