在R中测试分类器时出现此错误
Error in `[[<-.data.frame`(`*tmp*`, i, value = integer(0)) :
replacement has 0 rows, data has 2946
有人可以帮助我吗?
代码:
library(caret)
library(e1071)
traindata<-cbind(x_train,y_train, subject_train)
testdata<-cbind(x_test,y_test, subject_test)
model.nb<-naiveBayes(data = traindata, traindata$X5~.)
ntest<-testdata
ntest$X5<-NULL
nb.predict <- predict(model.nb, ntest)