[R] How to collect trees grown by rpart

Liaw, Andy andy_liaw at merck.com
Fri Mar 19 19:41:38 CET 2004


Yes, Jonathan has looked at randomForest, but for rpart trees, ipred might
be more appropriate.

Cheers,
Andy

> From:  Sean Davis
> 
> Jonathan,
> 
> Try making a list instead of an array.  See ?list.  Also, did 
> you look into
> random forests?  I'm not sure what you want to do, but there might be
> methods there to do some of the work for you.
> 
> Sean
> 
> On 3/19/04 1:12 PM, "Jonathan Williams"
> <jonathan.williams at pharmacology.oxford.ac.uk> wrote:
> 
> > I would like to collect the trees grown by rpart fits in an array,
> > in order to be able to use them later to predict new data. I have
> > tried to use parse and eval to do this, without success. I'd be
> > very grateful if someone could explain how to do it.
> > 
> > The kind of thing I hope to do is:
> > 
> > resmat=array(NA, 100)
> > for (run in 1:100) resmat[run]=rpart(y~., data=train[run])
> > 
> > So that, later, I can do:
> > for (run in 1:100) pred[run]=predict(resmat[run], newdat)
> > 
> > But, resmat[run] does not work, even though it saves the cptables.
> > 
> > Thanks, in advance,
> > 
> > Jonathan Williams
> > OPTIMA
> > Radcliffe Infirmary
> > Woodstock Road
> > OXFORD OX2 6HE
> > Tel +1865 (2)24356
> > 
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> >
> 
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
> 


------------------------------------------------------------------------------Notice:  This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message.  If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system.




More information about the R-help mailing list