Looking for feedback on the error below. I built a Random Forest classification model a couple years ago, and now I'm simply trying to run it again in rStudio on a new set of data. Hoping someone can educate me on the error.
#load libraries
library(readr)
library(randomForest)
#load Random Forest model
rf_model <- readRDS("my_model.rds")
#import files
set1 <- read_csv("set_1.csv")
set2 <- read_csv("set_2.csv")
set3 <- read_csv("set_3.csv")
#combine sets into single df
total <- rbind(set1, set2, set3)
#remove non_variables
total_to_score <- total[-c(1)]
#run model
scored_output <- predict(rf_model, total_to_score)
And here's the error:
Error in UseMethod("predict") :
no applicable method for 'predict' applied to an object of class "c('train', 'train.formula')"
I tried loading 'caret' too, but that didn't help.
I was able to make that command work after reinstalling rtools and rlang. I also installed caret but I'm not sure if that necessary.
At any rate, I think rtools was lacking or not found.