Calculating edges of a social network
General tips

Avoid defining your own loops. This is especially true with R because the chances are that there is another more elegant way to solve the problem using highly optimized functions.
Avoid rbind function inside loops especially if your are using it as an appending mechanism. This function creates a new empty data frame with a number of rows equal to number or rows of the old plus the number or rows of the new. Then it will copy the old and the new into this newly created data frame. This operation can be really expensive if you have large dataset. An optimizing solution can be achieved by creating an empty data frame with right size once outside the loop and populate it with the results using i index e.g all_results[i] = new_results inside the loop.
Avoid subset inside loops. The function documentation states that this is only a convienet function and should only be used in interactive setting.It also recommends that you use [ for subsetting.


Warning
This is a convenience function intended for use interactively. For programming it is better to use the standard subsetting functions like [, and in particular the non-standard evaluation of argument subset can have unanticipated consequences.

Moreover, it has the same issue as in the tip #2 since you are writing a new data frame minus the processed row in every go inside the loop.
Alternative solution
The problem can be solved using much less code than provided. Also it will only involves where the real data is the per_game table.
First you need to breakdown winner column in 3 for each winner. Since you seem familiar with the tidyverse family packages I will use functions from these packages.
library(&quot;tidyr&quot;)
library(&quot;dplyr&quot;)

per_game %&gt;% 
# Here we breakdown the winner columns into 3 using `spread()` function from tidyr
spread(winner, total_matches) %&gt;% 
# Then we add the black and white columns into new column called `victories`
rowwise() %&gt;% # to ensure summation excute on per row. 
mutate(victories  = sum(black, white,na.rm = TRUE))

# the results should look like this 

# Rowwise: 
   white_id           black_id           black  draw white victories
   &lt;chr&gt;              &lt;chr&gt;              &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;     &lt;dbl&gt;
 1 --jim--            &quot;voodooo&quot;              1    NA    NA         1
 2 -1-jedi_knighl_-1- &quot;erik123678&quot;          NA    NA     1         1
 3 -1-jedi_knighl_-1- &quot;kaY\\ran0098&quot;         2    NA     2         4
 4 -1-jedi_knighl_-1- &quot;pav1ngt&quot;              1    NA    NA         1
 5 -mati-             &quot;astronavtearl101&quot;    NA    NA     1         1
 6 -pavel-            &quot;hishamtheman&quot;        NA    NA     1         1
 7 1063314            &quot;dccbc,ss&quot;            NA    NA     1         1
 8 1111112222         &quot;crusova_ 33&quot;          1    NA    NA         1
 9 1111112222         &quot;steelviper&quot;           1    NA    NA         1
10 1240100948         &quot;aa22bb&quot;               1    NA    NA         1