title: Error: nrow(x) == n is not TRUE when using Train in Caret
body: <p>I have a training set that looks like</p>
  
  <pre><code>Name       Day         Area         X    Y    Month Night
  ATTACK    Monday   LA           -122.41 37.78   8      0
  VEHICLE  Saturday  CHICAGO      -1.67    3.15   2      0
  MOUSE     Monday   TAIPEI       -12.5    3.1    9      1
  </code></pre>
  
  <p><code>Name</code> is the outcome/dependent variable. I converted <code>Name</code>, <code>Area</code> and <code>Day</code> into factors, but I wasn't sure if I was supposed to for <code>Month</code> and <code>Night</code>, which only take on integer values 1-12 and 0-1, respectively. </p>
  
  <p>I then convert the data into matrix</p>
  
  <pre><code>ynn &lt;- model.matrix(~Name , data = trainDF)
  mnn &lt;- model.matrix(~ Day+Area +X + Y + Month + Night, data = trainDF)
  </code></pre>
  
  <p>I then setup tuning the parameters</p>
  
  <pre><code>nnTrControl=trainControl(method = "repeatedcv",number = 3,repeats=5,verboseIter = TRUE, returnData = FALSE, returnResamp = "all", classProbs = TRUE, summaryFunction = multiClassSummary,allowParallel = TRUE)
  nnGrid = expand.grid(.size=c(1,4,7),.decay=c(0,0.001,0.1))
  model &lt;- train(y=ynn, x=mnn, method='nnet',linout=TRUE, trace = FALSE, trControl = nnTrControl,metric="logLoss", tuneGrid=nnGrid)
  </code></pre>
  
  <p>However, I get the error <code>Error: nrow(x) == n is not TRUE</code> for the <code>model&lt;-train</code></p>
  
  <p>I also get a similar error if I use <code>xgboost</code> instead of <code>nnet</code></p>
  
  <p>Anyone know whats causing this?</p>