Prediction function not working on R

I create a random forest on my local desktop and save the model and upload it to the remote Linux machine. Below is the code snippet

iris.rf <- randomForest(species ~ ., data=iris, ntree=11)
save(iris.rf, file = "mymodel.rda")

      

On my Linux machine:

load(file="mymodel.rda")
out <- predict(iris.rf,data.frame(sepal_length=1,sepal_width=2,petal_length=3,petal_width=4))

      

When predicting the next error

Error in UseMethod ("predict"): no applicable method for "predicting" applied to object of class "c" ("randomForest.formula", "randomForest") "

A random forest model is loaded into the environment, but for some reason the predict

model call does not work Any idea why this isn't working?

+3


source to share





All Articles