[R] randomForest2Rules

saskay sashi1985 at gmail.com
Sun Sep 18 22:33:00 CEST 2011


Hi,
I'm trying to extract the rules from every tree in the random forest model
that I've created. I've used randomForest2Rules function from "rattle"
package however I get an error "Error in if (var.class == "character" |
var.class == "factor") { : 
  argument is of length zero" 

Sample code:
library(rattle)
library(randomForest)
iris.10tree <- randomForest(Species ~ ., data=iris, ntree=10)
iris.10tree
printRandomForests(iris.10tree) #this prints the rules as described in the
vignette
ruleset<-randomForest2Rules(iris.10tree) # this does not work and gives the
error I mentioned above.

Rattle package: http://cran.r-project.org/web/packages/rattle/rattle.pdf

Please can someone tell me where I'm going wrong.

--
View this message in context: http://r.789695.n4.nabble.com/randomForest2Rules-tp3822530p3822530.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list