Skip to content

Commit

Permalink
Change to predict.train to fix issue #574
Browse files Browse the repository at this point in the history
  • Loading branch information
topepo committed Mar 24, 2017
1 parent 7f5d897 commit 2576c15
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/caret/R/predict.train.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ predict.train <- function(object, newdata = NULL, type = "raw", na.action = na.o
}
} else stop("please specify data via newdata")
}
if("xNames" %in% names(object$finalModel))
newdata <- newdata[, colnames(newdata) %in% object$finalModel$xNames, drop = FALSE]

if(type == "prob") {
out <- probFunction(method = object$modelInfo,
Expand Down

0 comments on commit 2576c15

Please sign in to comment.