[R] Fwd: Re: Party extract BinaryTree from cforest?

Torsten Hothorn Torsten.Hothorn at R-project.org
Thu Oct 6 09:13:11 CEST 2011


> ---------- Forwarded message ----------
> Date: Wed, 5 Oct 2011 21:09:41 +0000
> From: Chris <christopher.a.hane at gmail.com>
> To: r-help at stat.math.ethz.ch
> Subject: Re: [R] Party extract BinaryTree from cforest?
>
> I found an internal workaround to this to support printing and plot type 
> simple,
>
> tt<-party:::prettytree(cf at ensemble[[1]], names(cf at data at 
> get("input")))
>> npt <- new("BinaryTree")
>> npt at tree<-tt
>> plot(npt)
> Error in terminal_panel(<S4 object of class "BinaryTree">) :
>  âctreeobjâ is not a regression tree

library("party")
cf <- cforest(Species ~ ., data = iris)
pt <- party:::prettytree(cf at ensemble[[1]], names(cf at data@get("input")))
pt
nt <- new("BinaryTree")
nt at tree <- pt
nt at data <- cf at data
nt at responses <- cf at responses
nt
plot(nt)

will do.

Torsten

>> plot(npt, type="simple")
>
> Any additional help is appreciated.
>
> ______________________________________________
> R-help at 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.


More information about the R-help mailing list