title: Error: nrow(x) == n is not TRUE in Caret train
body: <p>I have a dataset "B_data" which looks like this. ( 84 Obs and 56 variables). </p>
  
  <pre><code>   ToF_Freq1 ToF_Freq2 ToF_Freq3 Hat_ToF_sd_Freq1  Hat_ToF_mean_Freq2  pfit_1
  1  16.40474  17.22727  22.16426  0.6888009          30.24077          36.5500
  2  16.45814  19.27711  21.43667  0.4256916          31.48554          74.85000
  
  dim(B_data)
  [1] 84 56
  </code></pre>
  
  <p>Then i convert the target variables to "factor". </p>
  
  <pre><code>Flag_B &lt;- as.factor(datas$factor_B)
  
  head(Flag_B)
  [1] 1  1  1  1  1  10
  Levels: 1 10 3 5
  
  length(Flag_B)
  [1] 86
  </code></pre>
  
  <p>and train the data set. </p>
  
  <pre><code>control &lt;- trainControl(method = "repeatedcv",number = 3, repeats = 3)
  rf_random &lt;- train(B_data, Flag_B, method="rf", trcontrol = control, metric="Accuracy")
  </code></pre>
  
  <p>I have the similar error as in the post <a href="https://stackoverflow.com/questions/35527492/error-nrowx-n-is-not-true-when-using-train-in-caret">nrow(x) ==n is not true.</a></p>
  
  <pre><code>Error: nrow(x) == n is not TRUE. 
  </code></pre>
  
  <p>How do i fix this. I tried reading through but its of not much help. </p>
  
  <p>Many thanks. </p>