title: rpart caret "Argument params not matched" error
body: <p>I am having trouble with the caret package rpart model.  When I run the code in Part 1 I get the following error:</p>
  
  <h1>Part 1</h1>
  
  <pre><code>library(rpart)
  library(caret)
  
  creditNames &lt;- c("Checking", "Duration", "CreditHistory", "Purpose",
                   "CreditAmount", "Savings", "Employment", 
                   "InstallmentRate", "GenderMarital", "OtherDebtors",
                   "YearsAtResidence", "RealEstate", "Age", 
                   "OtherInstallment", "Housing", "ExistingCredit",
                   "Job", "NumLiable", "Phone", "Foreign", "Credit")
  
  url="http://archive.ics.uci.edu/ml/machine-learning-databases/statlog/german/german.data"
  credit_data &lt;- read.table(url, sep=" ", header = FALSE, 
                    col.names = creditNames, 
                    stringsAsFactors = FALSE)
  
  creditHistory &lt;- c(A30="All Paid", A31="All Paid This Bank",
                     A32="Up To Date", A33="Late Payment",
                     A34="Critical Account")
  credit_data$CreditHistory &lt;- as.factor(creditHistory[credit_data$CreditHistory])
  
  credit_data$Credit &lt;- ifelse(credit_data$Credit == 1, "Good", "Bad")
  credit_data$Credit &lt;- factor(credit_data$Credit, levels = c("Good", "Bad"))
  
  fitControl &lt;- trainControl(method = 'cv', number = 6)
  
  Grid &lt;- expand.grid(
                      cp=.02)
  
  vars &lt;- names(credit_data)[c(5,13,3,7)]
  samp.f &lt;- as.formula(paste(names(credit_data)[21], paste(vars, collapse = " + "),sep="~"))
  
  myvars &lt;- c("Credit", "CreditAmount", "Age") #"CreditHistory", ,  "Employment"
  
  
  samp.m &lt;- train(samp.f,
                  data=credit_data,
                  method='rpart',
                  trControl = fitControl,
                  tuneLength=20,
                  metric = "Accuracy",
                  tuneGrid = Grid,
                  na.action = na.omit,
                  params=list(split='information'))
  </code></pre>
  
  <blockquote>
    <p>model fit failed for Fold1: cp=0.02 Error in (function (formula, data,
    weights, subset, na.action = na.rpart,  :    Argument params not
    matched</p>
  </blockquote>
  
  <p>However, when I run the code in Part 2, I do not get an error.  </p>
  
  <h1>Part 2</h1>
  
  <pre><code>for (test_cp in seq(.001,.02,.001)){
     test&lt;-rpart(samp.f, dat=credit, cp=test_cp, maxdepth=5)
  }
  </code></pre>
  
  <p>Any suggestions?</p>
  
  <p>I am running the following setup:</p>
  
  <pre><code>R version 3.4.4 (2018-03-15)
  Platform: x86_64-w64-mingw32/x64 (64-bit)
  Running under: Windows &gt;= 8 x64 (build 9200)
  other attached packages:
  [1] caret_6.0-79    ggplot2_2.2.1   lattice_0.20-35 rpart_4.1-13 
  </code></pre>