title: rpart giving same results for cross-validation and no CV
body: <p>Like the title says, I'm trying to run a decision tree both with and without cross-validation using the rpart package in R. I'm doing this using the xval parameter, as described in the vignette (<a href="https://cran.r-project.org/web/packages/rpart/vignettes/longintro.pdf" rel="nofollow noreferrer">https://cran.r-project.org/web/packages/rpart/vignettes/longintro.pdf</a>)</p>
  
  <p>Unfortunately, I'm getting the same tree with and without CV. I've compared the calculation time for each and the CV model looks like it takes about 10 times as long, so its apparently doing something, I just can't figure out what.  </p>
  
  <p>I've also redone the model a number of times with different complexity parameters, but it hasn't made any difference. </p>
  
  <p>Here's sample code that shows my problem, the printcp's show the same results and the predictions from both on the training and a hold-out set are the same. </p>
  
  <pre><code>library(rpart)
  library(caret)
  
  abalone &lt;- read.csv(file = 'https://archive.ics.uci.edu/ml/machine-learning-databases/abalone/abalone.data',header = FALSE)
  names(abalone) &lt;- c("sex", "length", "diameter", "height", "whole_weight", "shucked_weight", "viscera_weight", "shell_weight", "rings") 
  
  train_set &lt;- createDataPartition(abalone$sex, times = 1, p = 0.8, list = FALSE)
  
  abalone_train &lt;- slice(abalone, train_set)
  abalone_test &lt;- slice(abalone, -train_set)
  
  abalone_fit_noCV &lt;- rpart(sex ~ ., 
                       data = abalone_train, 
                       method = "class", 
                       parms = list(split = 'information'),
                       control = rpart.control(xval = 0,
                                               cp = 0.005)) 
  
  abalone_fit_CV &lt;- rpart(sex ~ ., 
                          data = abalone_train, 
                          method = "class", 
                          parms = list(split = 'information'),
                          control = rpart.control(xval = 10,
                                                  cp = 0.005))
  
  printcp(abalone_fit_noCV)
  printcp(abalone_fit_CV)
  
  CV_pred &lt;- predict(abalone_fit_CV, type = "class")
  noCV_pred &lt;- predict(abalone_fit_noCV, type = "class")
  confusionMatrix(CV_pred, noCV_pred)
  
  CV_pred &lt;- predict(abalone_fit_CV, abalone_test, type = "class")
  noCV_pred &lt;- predict(abalone_fit_noCV, abalone_test, type = "class")
  confusionMatrix(CV_pred, noCV_pred)
  </code></pre>