if (requireNamespace("caret", quietly = TRUE) &
requireNamespace("randomForest", quietly = TRUE))
{
model_final <- caret::train(x = subset(mtcars, select = -mpg), y = mtcars$mpg, method = "rf")
imp <- importance(model_final)
plot(imp)
}
Run the code above in your browser using DataLab