title: Taking value of previous row away from current row in R
body: <p>I have a data frame formatted like so:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>GameId</th>
  <th>Eval</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>1.00</td>
  </tr>
  <tr>
  <td>1</td>
  <td>1.50</td>
  </tr>
  <tr>
  <td>1</td>
  <td>0.50</td>
  </tr>
  <tr>
  <td>2</td>
  <td>-1.00</td>
  </tr>
  <tr>
  <td>2</td>
  <td>2.00</td>
  </tr>
  <tr>
  <td>2</td>
  <td>1.00</td>
  </tr>
  <tr>
  <td>3</td>
  <td>1.50</td>
  </tr>
  <tr>
  <td>3</td>
  <td>-0.50</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I would like a new column which accounts for differences between the current row and the previous, but resets at the start of the next GameId so that it looks like so:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>GameId</th>
  <th>Eval</th>
  <th>Diff</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>1.00</td>
  <td>NA</td>
  </tr>
  <tr>
  <td>1</td>
  <td>1.50</td>
  <td>0.50</td>
  </tr>
  <tr>
  <td>1</td>
  <td>0.50</td>
  <td>-1.00</td>
  </tr>
  <tr>
  <td>2</td>
  <td>-1.00</td>
  <td>NA</td>
  </tr>
  <tr>
  <td>2</td>
  <td>2.00</td>
  <td>3.00</td>
  </tr>
  <tr>
  <td>2</td>
  <td>1.00</td>
  <td>-2.00</td>
  </tr>
  <tr>
  <td>3</td>
  <td>1.50</td>
  <td>NA</td>
  </tr>
  <tr>
  <td>3</td>
  <td>-0.50</td>
  <td>-2.00</td>
  </tr>
  </tbody>
  </table>
  </div>