title: Get the next row after a specific one in R?
body: <pre><code>Rank   Values
  1      e
  2      er
  3      gr
  4      ie
  5      wv
  1      iop
  1      ni
  2      ot
  3      kr
  4      lw
  </code></pre>
  
  <p>I have a column "rank" in a data frame and I want add get the rows that are 1 and check to see if they have a 2 after. How can I do this within a for loop? I know this can be done with an if statement I am just not sure how to grab the correct rows? I need to basically delete the rows that are ranked 1 and do not have a following rank 2. </p>
  
  <p>Example Output:</p>
  
  <pre><code>Rank   NewCol
  1      e       
  2      er
  3      gr
  4      ie
  5      wv
  1      ni
  2      ot
  3      kr
  4      lw
  </code></pre>
  
  <p>(Got rid of iop since its rank is 1 with no following 2)</p>