title: R rfe function "caret" Package error: there should be the same number of samples in x and y
body: <p>As I'm trying the rfe example from the "caret" package taken from <a href="http://machinelearningmastery.com/feature-selection-with-the-caret-r-package/" rel="nofollow noreferrer">here</a>, I kept on receiving this error </p>
  
  <pre><code>  Error in rfe.default(d[1:2901, ], c(1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3,  : 
    there should be the same number of samples in x and y
  </code></pre>
  
  <p>This question <a href="https://stackoverflow.com/questions/9143610/r-trying-to-get-caret-rfe-to-work">has been asked</a> but its solution doesn't apply in this case.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>set.seed(7)
  # load the library
  library(mlbench)
  library(caret)
  
  # load the data
  d &lt;- read.table("d.dat")
  
  # define the control using a random forest selection function
  control &lt;- rfeControl(functions=rfFuncs, method="cv", number=10)
  
  # run the RFE algorithm
  results &lt;- rfe(d[1:2901, ],   c(1,1,1,1, 1, 1,2,2,2, 3 ,3,3,4, 4, 4),   sizes=c(1:2901), rfeControl=control)
  
  # summarize the results
  print(results)
  </code></pre>
  
  <p>The dataset is a data frame of 2901 rows (features) and 15 columns. The vector c(1,1,1,1,1,1,2,2,2,3,3,3,4,4,4) is the predictor for the features.</p>
  
  <p>What parameter am I setting wrong?</p>