## Not run: 
# 
# knnFit <- train(Species ~ ., data = iris, method = "knn", 
#                 trControl = trainControl(method = "cv"))
# 
# rdaFit <- train(Species ~ ., data = iris, method = "rda", 
#                 trControl = trainControl(method = "cv"))
# 
# predict(knnFit)
# predict(knnFit, type = "prob")
# 
# bothModels <- list(knn = knnFit,
#                    tree = rdaFit)
# 
# predict(bothModels)
# 
# extractPrediction(bothModels, testX = iris[1:10, -5])
# extractProb(bothModels, testX = iris[1:10, -5])
#   ## End(Not run)
Run the code above in your browser using DataLab