title: R: Create a flag that is 0 or 1 for a whole group if one value in that group is below a certain threshold
body: <p>I have a dataset like this:</p>
  
  <pre><code>group  services
  1         75
  1         105
  1         110
  2         110
  2         110
  2         110
  </code></pre>
  
  <p>I want to create a flag where if any of the group service values fall below 100, it is flagged 0. If they are all above 100, it is flagged 1.
  Output would be:</p>
  
  <pre><code>group    services      flag
  1         75            0
  1         105           0
  1         110           0
  2         110           1
  2         110           1
  2         110           1
  </code></pre>
  
  <p>The dataset is thousands of groups long, so I'm not sure how to do this. I tried using dplyr 
  as</p>
  
  <pre><code> dataset%&gt;%
         group_by_(group)%&gt;%
         mutate(flag:= services&gt;=100)
  </code></pre>
  
  <p>I tried searching, but couldn't find an answer as to how to get the flag to apply to a whole group for a large dataset with lots of groups. </p>