title: Missing values error in train() function Caret for trees
body: <p>I'm new using R and I'm trying to build a decision tree. I've already used the package <code>party</code> for <code>ctree</code> and <code>rpart</code> for rpart. </p>
  
  <p>But, as I needed to do cross validation for my model I start using the <code>caret</code> package since I'm able to do that by using the function `train() and the method I want to use. </p>
  
  <pre><code>library(caret)
  cvCtrl &lt;- trainControl(method = "repeatedcv", repeats = 2,
                     classProbs = TRUE)
  
  ctree.installed&lt;- train(TARGET ~ OPENING_BALANCE+ MONTHS_SINCE_EXPEDITION+
                      RS_DESC+SAP_STATUS+ ACTIVATION_STATUS+ ROTUL_STATUS+ 
                      SIM_STATUS+ RATE_PLAN_SEGMENT_NORM,
                      data=trainSet,
                      method = "ctree",
                      trControl = cvCtrl)
  </code></pre>
  
  <p>However, my variables <code>OPENING_BALANCE</code> and <code>MONTHS_SINCE_EXPEDITION</code> have some missing values and the function doesn't work because of that. I don't understand why this happens since I'm trying to build a tree. This problem doesn't occur when i'm using the other packages.</p>
  
  <p>This is the error:</p>
  
  <pre><code>Error in na.fail.default(list(TARGET = c(3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,  : 
  missing values in object
  </code></pre>
  
  <p>I didn't want to use <code>na.action=pass</code> since I really don't want to discard those observations.</p>
  
  <p>Am I doing something wrong? Why is this happening? Do you have any suggestions for this?</p>