title: simple for loop doesnt work because of the condition error
body: <p>I am getting frustrated because my simple for loop 
  does not work for reasons I cant understand,
  My data looks like this,</p>
  
  <pre><code>      PERSON_ID EVENT
  58  10000002174  C569
  64  10000002207  C569
  66  10000002210  C569
  91  10000002676  C569
  111 10000006286  C569 
  113 10000006288  C569
  117 10000006293  C569 
  180 10000010009  C569
  183 10000010011  C569
  184 10000010011  C569
  </code></pre>
  
  <p>I want to change C569 to C5692
  if one person has more than one C569. </p>
  
  <pre><code>      PERSON_ID EVENT
  58  10000002174  C569
  64  10000002207  C569
  66  10000002210  C569
  91  10000002676  C569
  111 10000006286  C569 
  113 10000006288  C569
  117 10000006293  C569 
  180 10000010009  C569
  183 10000010011  C569
  184 10000010011  C5692
  </code></pre>
  
  <p>so result should look like this</p>
  
  <pre><code>for (i in 1:nrow(OV)){
     if (OV[i,1] == OV[(i+1),1]){ OV[(i+1),2] &lt;- "C5692"}
     }
  </code></pre>
  
  <p>but this gives me error</p>
  
  <pre><code>Error in if (OV[i, 1] == OV[(i + 1), 1]) { : 
    missing value where TRUE/FALSE needed
  </code></pre>
  
  <p>could anybody enlighten me? thank you very much</p>