Displaying 1 result from an estimated 1 matches for "finaldataset".
2005 Aug 26
2
problem with certain data sets when using randomForest
...ot;)
# load the iris plant data set
dataset <- iris
numberarray <- array(1:nrow(dataset), nrow(dataset),
1)
# include only instances with Species = setosa or
virginica
indices <- t(numberarray[(dataset$Species == "setosa"
|
dataset$Species == "virginica") == TRUE])
finaldataset <- dataset[indices,]
# just to let you see the 3 classes
levels(finaldataset$Species)
# create the random forest
randomForest(formula = Species ~ ., data =
finaldataset, ntree = 5)
# The error message I get
Error in randomForest.default(m, y, ...) :
Can't have empty classes in y....