Compare values in data.frame from different rows
<p>I have an R data.frame of college football data, with two entries for each game (one for each team, with stats and whatnot). I would like to compare points from these to create a binary Win/Loss variable, but I have no idea how (I'm not very experienced with R). 
Is there a way I can iterate through the columns and try to match them up against another column (I have a game ID variable, so I'd match on that) and create aforementioned binary Win/Loss variable by comparing points values?</p>

<p>Excerpt of dataframe (many variables left out):</p>

<pre><code>Team Code  Name      Game Code            Date          Site    Points
5         Akron      5050320051201     12/1/2005        NEUTRAL   32
5         Akron     404000520051226    12/26/2005       NEUTRAL   23
8         Alabama   419000820050903    9/3/2005         TEAM      37
8         Alabama   664000820050910    9/10/2005        TEAM      43
</code></pre>

<p>What I want is to append a new column, a binary variable that's assigned 1 or 0 based on if the team won or lost. To figure this out, I need to take the game code, say 5050320051201, find the other row with that same game code (there's only one other row with that same game code, for the other team in that game), and compare the points value for the two, and use that to assign the 1 or 0 for the Win/Loss variable.  </p>