title: R Caret Package Error - At least one of the class levels is not a valid R variable name
body: <p>I am receiving the following error in R when stacking using the caret package.</p>
  
  <blockquote>
    <p>"Error: At least one of the class levels is not a valid R variable name; This will cause errors when class probabilities are generated because the variables names will be converted to  not5, X5sets . Please use factor levels that can be used as valid R variable names  (see ?make.names for help)." </p>
  </blockquote>
  
  <p>The below is the code I am trying to run.</p>
  
  <pre><code>library(caretEnsemble)
  control &lt;- trainControl(method="repeatedcv", number=10, repeats=3, savePredictions=TRUE, classProbs=TRUE)
  algorithmList &lt;- c('rpart', 'knn', 'svmRadial')
  set.seed(222)
  models &lt;- caretList(Tsets ~ MatchSurface + MatchRound + AgeDiff + SameHand + HeightDiff, data=up_sample, trControl=control, methodList=algorithmList)
  results &lt;- resamples(models)
  </code></pre>
  
  <p>When I remove <code>classProbs=TRUE</code>, the code runs but I want to keep this as there is further code I am trying to run after this which requires it. All of my variables are factors or integers and I have changed all classes so they do not have "0"'s and "1"s. Therefore I cant figure out why the code wont run.</p>
  
  <p>I have attached a picture of the data structure below. Would be great if anyone had some advice.</p>
  
  <p><img src="https://i.stack.imgur.com/sCFqf.png" alt="Data Structure"></p>