[R] FSelector and RWeka problem

Yanwei Song yanwei.song at gmail.com
Thu Sep 8 02:47:34 CEST 2011


Hi all,

Last post didn't give the plain format:

I was trying to combine RWeka and FSelector, and do the forward feature selection with J48/C5.4 decision tree:

Here is the code:
#==================
library(RWeka)
library(FSelector)
library(rpart)

                                                                     
data(iris)
evaluator <- function(subset) {
 p <- J48(as.simple.formula(subset, "Species"), data=iris)
 e <- evaluate_Weka_classifier(p)
 print(subset)
 print(e$details[1])
 return(e$details[1])
}


subset <- forward.search(names(iris)[-5], evaluator)
=========================
I got this error, when I ran it:

Error in paste(attributes, sep = "", collapse = " + ") :
 cannot coerce type 'closure' to vector of type 'character'

I don't know how I could fix this problem.
Thanks.


Yanwei



More information about the R-help mailing list