[R] How to collect trees grown by rpart
Jonathan Williams
jonathan.williams at pharmacology.oxford.ac.uk
Fri Mar 19 19:12:53 CET 2004
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
More information about the R-help
mailing list