title: Add a new column in dataset
body: <p>I have a dataset which looks like this:
  <a href="https://i.stack.imgur.com/1NzWl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1NzWl.png" alt="enter image description here"></a></p>
  
  <p>I need to add a column "forgets" which would distinguish if there were more than 2 wrong hits, the it should contain "yes", and if less than or equal to 2 attempts, then "no"</p>
  
  <p>I am grouping first, and then trying to add "yes" and "no" values</p>
  
  <pre><code>library(dplyr)
  p &lt;- group_by(d,  Participant, Session, Condition, Block, PassedIconName)
  
  for (i in 1:nrow(p)){
    if (p$WrongHitsCount[i] &gt;2){
      p$Forget[i] &lt;- "yes"
    } else {
      p$Forget[i] &lt;-"no"
    }
  }
  </code></pre>
  
  <p>But this code puts "yes" to the first attempts of the datafile, and for the rest, it puts "no". I need to have "no" in all the instances for an icon that was hit incorrectly more than 2 times.</p>
  
  <p>Could you please tell me how it can be achieved?</p>