[R] unlist (rpart.object.list)

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Aug 29 09:56:05 CEST 2002


chr.schulz at email.de wrote:
> 
> Hello,
> can me please help anbody how it is possible
> unlist a "rpart.object.list" i.e. from bagging(ipred) to
> plot this "unique" several rpart.objects .
> 
> ..i make attempts with unlist, get really atomic
> elements, but need only the different tree's !

Right, that's what unlist() does.


In ?bagging (package ipred), you will find in section "Value":

  Value 
  An object of class bagging: a list containing the following objects 

  mt   list of length nbagg containing rpart trees. 


So, following the first example in ?bagging, you get a list of trees
with:

 X <- as.data.frame(matrix(rnorm(1000), ncol=10))
 y <- factor(ifelse(apply(X, 1, mean) > 0, 1, 0))
 learn <- cbind(y, X)

 mt <- bagging(y ~., data=learn, coob=TRUE)
 mt$mt

Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list