Hi I'm trying to use RWeka to use a NaiveBayes Classifier(the Weka version). However it crashes whenever there is a NA in the class Gender
Here is the.code I have with d2 as the data frame. The first call to NB doesn't make R crash but the second call does. NB <- make_Weka_classifier("weka/classifiers/bayes/NaiveBayesSimple") d2[,64]<-d2$Gender=="M" NB(Gender~age,d2,na.action=na.exclude) #1st call d2$Gender[d2$Gender==""]<-NA valid.set<-(!is.na(d2$Gender)&(!is.na(d2$age))) NB(formula=Gender~age,data=d2[valid.set,],subset=valid.set,na.action=na.exclude) Anybody have an idea how to fix this. or a very detailed explanation of how to use "naiveBayes" function from e1071 package? I tried using this function , too. However I can't figure out what the returning error means? naiveBayes(formula=Gender~age,data=d2[valid.set,],subset=valid.set,na.action=na.exclude) I get the following error Error in tapply(var, y, mean, na.rm = TRUE) : arguments must have same length Thanks -- Sancar Adali Johns Hopkins University Graduate Student ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.