title: glm.fit: algorithm did not converge
body: <p>I am working on classification using Sonar data.</p>
  
  <p>I tried to perform logistic regression using the <strong>caret</strong> package:</p>
  
  <pre><code>library(mlbench)
  library(caret)
  
  data("Sonar")
  head(Sonar)
  
  #remove observations with correlation higher than 0.9
  cormat &lt;- cor(Sonar[,-61])
  highlycorrelated &lt;- findCorrelation(cormat, cutoff = 0.9)
  print(highlycorrelated)
  Sonar &lt;- Sonar[-c(15,18,20),]
  
  
  #Logistic Regression using caret
  mod &lt;- train(Sonar[,-61],Sonar[,61], method = "glm", preProcess = c("center", "scale"), tuneLength = 3)
  mod
  
  
  </code></pre>
  
  <p>The following warning messages appear:</p>
  
  <pre><code>glm.fit: algorithm did not converge
  glm.fit: fitted probabilities numerically 0 or 1 occurred
  </code></pre>
  
  <p>Can you explain what does this message mean and what's a way to solve the problem that causes it?</p>