title: Predict using a ranger model
body: <p>I have the following code:</p>
  
  <pre><code>tc &lt;- trainControl(method = "repeatedcv", 
                     number = 5 ,
                     repeats = 5, 
                     summaryFunction = twoClassSummary, 
                     classProbs = TRUE,
                     verboseIter = TRUE)
  
  model &lt;- train(class ~ .
                 , data=myData 
                 , trControl=tc
                 , method="ranger"
                 , metric="ROC"
                 , importance = 'impurity'
                 )
  </code></pre>
  
  <p>This produces a model which I would like to use to predict unseen data points. The following works correctly:</p>
  
  <pre><code>predict(model,myData)
  </code></pre>
  
  <p>It produces a list of results which is exactly what i want. However I will be using the model on single row samples in future (There will be user input that will be used to create a prediction). So to test this is did the following:</p>
  
  <pre><code>predict(model,myData[1,])
  </code></pre>
  
  <p>, and get the following error.</p>
  
  <blockquote>
    <p>Error in apply(out, 1, which.max) : dim(X) must have a positive length</p>
  </blockquote>
  
  <p>If I change the code to be:</p>
  
  <pre><code>predict(model, myData[1:2,])
  </code></pre>
  
  <p>,I again get results.</p>
  
  <p>It seems like the predict function and the ranger model does not play nicely when there is only one row in the input data set. Or, I am doing something wrong. Any help would be appreciated.</p>