title: Error in Random Forest: "Need at least two classes to do classification"
body: <p>I'm trying to do a species distribution model and I'm following the guide "Species distribution modeling with R" from Robert J. Hijmans and Jane Elith. </p>
  
  <p>Everything seems to be OK but when I'm trying to run the RandomForest I get this error message: </p>
  
  <pre><code>"Need at least two classes to do classification". 
  </code></pre>
  
  <p>The code I'm using is:</p>
  
  <pre><code>library(randomForest)
  model &lt;- factor (pa) ~ Bio3 + Bio2 + Bio16 + Bio11 + aspect + depth + dem + my_epikrat + corine_2000
  rfabies &lt;- randomForest(model, data=envtrain, na.action=na.omit, ntrees=1000)
  
  
  Error in randomForest.default(m, y, ...) :
    Need at least two classes to do classification.
  </code></pre>
  
  <p>What may cause this problem? Can anyone help me?</p>