title: R caret: difference between train and rfe
body: <p>since there are some methods available in the caret-ml that <a href="http://topepo.github.io/caret/featureselection.html" rel="nofollow">don't have a built in feature selection</a>, I was experimenting with <code>rfe</code>.</p>
  
  <p><strong>Can somebody explain, what the difference between</strong> <code>train()</code> and <code>rfe()</code> is - aside from training time and a ranked feature list? Are things only <code>train()</code> can do and vice versa?</p>
  
  <p>Here is my example to illustrate the issue:</p>
  
  <pre><code># worker functions
  useRFE &lt;- function(trainctrl) {
      control &lt;- rfeControl(functions=caretFuncs, 
      method="cv", 
      repeats=5, 
      number=5, 
      returnResamp="final", 
      verbose = TRUE)
  
  
   # run the RFE algorithm
   resultsRFE &lt;-
      rfe(
         training[,1:ncol(iris) - 1], 
         training$Species, 
         sizes = subsets, 
         rfeControl = control,
         method = "svmRadial",
         metric = "Accuracy",
         trControl = trainctrl
      )
  
    # test
    predictedClasses &lt;- predict(resultsRFE, testing)
    confmat &lt;- confusionMatrix(data = predictedClasses$pred, reference = testing$Species)
    confmat
    # Balanced Accuracy = 100%
  }
  
  useTrain &lt;-  function(trainctrl) {      
    # train
    resultsTrain &lt;- train(
         Species ~ .,
         data = training,
         method = "svmRadial",
         metric = "Accuracy",
         trControl = trainctrl
    )
  
    # test
    predictedClasses &lt;- predict(resultsTrain, testing)
    confmat &lt;- confusionMatrix(data = predictedClasses, 
         reference = testing$Species)
    confmat
    # Balanced Accuracy = 100%
  }
  # load library
  library(caret)
  
  # load iris data
  data(iris)
  
  # create datasets
  inTrain &lt;- createDataPartition(y = iris$Species,
      p = .75,
      list = FALSE)
  
  ## The output is a set of integers for the rows of Sonar
  ## that belong in the training set.
  training &lt;&lt;- iris[ inTrain,]
  testing &lt;&lt;- iris[-inTrain,]
  
  # select count of features
  subsets &lt;- c(1:ncol(iris)-1)
  
  # set controls
  trainctrl &lt;- trainControl(
      classProbs= TRUE, 
      method="cv", 
      repeats=5, 
      number=5, 
      verbose = TRUE)
  
  # compare
  ptm &lt;- proc.time()
  useTrain(trainctrl = trainctrl)
  proc.time() - ptm
  # Accuracy : 0.9167    
  # User      System     passed 
  # 1.54      0.06       10.27
  
  ptm &lt;- proc.time()
  useRFE(trainctrl = trainctrl)
  proc.time() - ptm
  # Accuracy : 0.9167
  # User      System     passed 
  # 0.86      0.04       24.44  
  </code></pre>