models <- caretList(
x = iris[1:100, 1:2],
y = iris[1:100, 3],
methodList = c("rpart", "glm")
)
meta_model <- caretStack(models, method = "lm")
RMSE(predict(meta_model, iris[101:150, 1:2]), iris[101:150, 3])
Run the code above in your browser using DataLab