I'm trying to fit a random forest like:
rf_model<-rand_forest(trees = 2000, mtry = 4, mode = "classification") %>%
set_engine("randomForest",importance=T, localImp = T, ) %>%
fit(y ~ ., data = train.data)
But it returns an error:
Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘fit’ for signature ‘"rand_forest", "data.frame"’