Hi everybody,
There are anyone get this kind of error when run randomforest model in caret?
library(randomForest)
library(mlbench)
library(caret)
library(lattice)
# Load Dataset
data(Sonar)
dataset <- Sonar
x <- dataset[,1:60]
y <- dataset[,61]
control <- trainControl(method="repeatedcv",
number=10,
repeats=3)
metric <- "Accuracy"
set.seed(123)
mtry <- sqrt(ncol(x))
tunegrid <- expand.grid(.mtry=mtry)
rf_default <- train(Class~.,
data=dataset,
method="rf",
metric=metric,
tuneGrid=tunegrid,
trControl=control)
print(rf_default)
And error as below:
Error in { : object 'v2' not found