FromUser To User Weight
U1 U3 1
U2 U4 2
U3 U2 1
U1 U3 0.5
U2 U4 -1
I have the following DF in R.
FromUser To User Weight
U1 U3 1
U2 U4 2
U3 U2 1
U1 U3 0.5
U2 U4 -1
As you can see there are duplicates in terms of fron-to-to interaction. I want to create a df with unique from and to users with weights as sum of weights. So the updated table based on above should look like
FromUser To User Weight
U1 U3 1.5
U2 U4 1
U3 U2 1
I am not sure how to go about this. I am sure there is a novel dplyr soln, but cant seem to find it.