Sum over a column and remove duplicates simultaneously
<pre><code>FromUser   To User  Weight
U1          U3       1
U2          U4       2
U3          U2       1
U1          U3       0.5
U2          U4       -1
</code></pre>

<p>I have the following DF in R. </p>

<pre><code>FromUser   To User  Weight
U1          U3       1
U2          U4       2
U3          U2       1
U1          U3       0.5
U2          U4       -1
</code></pre>

<p>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</p>

<pre><code>FromUser   To User  Weight
U1          U3       1.5
U2          U4       1
U3          U2       1
</code></pre>

<p>I am not sure how to go about this. I am sure there is a novel dplyr soln, but cant seem to find it.</p>