[R] Error in -class : invalid argument to unary operator

srfc ciaran.pender at gmail.com
Wed Mar 4 17:30:27 CET 2009

Hi guys I have been using R  for a few months now and have come across an
error that I have been trying to fix for a week or so now.I am trying to
build a classifer that will classify the wine dataset using Naive Bayes.

My code is as follows

library (e1071)

wine<- read.csv("C:\\Rproject\\Wine\\wine.csv")
split<-sample(nrow(wine), floor(nrow(wine) * 0.5))
wine_training <- wine[split, ] 
wine_testing <- iris[-split, ]

naive_bayes <-naiveBayes(class~.,data=wine_training) 

x_testing <- subset(wine_testing, select = -class)
y_testing <- wine_testing$class # just grab Species variable of
pred <- predict(naive_bayes, x_testing)

tab<-table(pred, y_testing)

ca <- classAgreement(tab)


when I enter this code in I get the error 

Error in -class : invalid argument to unary operator

If anybody could give me anysort of advice this would be most welcome,Thanks
View this message in context: http://www.nabble.com/Error-in--class-%3A-invalid-argument-to-unary-operator-tp22333600p22333600.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list