1
training_set$left <- factor(training_set$left)
test_set$left <- factor(test_set$left)

When I type

classifier3 <- randomForest(left~., data = training_set, ntree = 50)

I get the error

Error in na.fail.default(list(left = c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, : missing values in object

RLave
  • 8,144
  • 3
  • 21
  • 37
Chintoo Das
  • 11
  • 1
  • 2

1 Answers1

0

Unfortunately, I can't post this as comment because I don't have enough reputation. You will find the answer here: Link. In case of na.fail.default use na.exclude() on the whole data frame at once or an imputation method like na.roughfix from randomForest.

Claudiu Papasteri
  • 2,469
  • 1
  • 17
  • 30