title: Warnings in R - making note
body: <p>I'm trying to run a function (glm) in R 1000 times (with slightly different inputs each time). Sometimes I'll get a warning (because separation occurs) - all I want to do is count how many times this occurs (so how many times in the 1000 iterations I get the warning "glm.fit: fitted probabilities numerically 0 or 1 occurred").</p>
  
  <p>So my code would look something roughly like:</p>
  
  <pre><code>warningCount &lt;- 0
  for(i in 1:1000) {
    [generate data]
    glm(y ~ ., family="binomial", data=generated_data)
    if( I got the warning ) warningCount &lt;- warningCount + 1
  }
  </code></pre>
  
  <p>I just want to know how to write the line if( I got a warning ) properly.</p>
  
  <p>Thanks</p>