# How can I get each Decision Tree from Random Forest as independent prediction model? [closed]

I am using R package randomForest in my research. My question is how can I get each Tree as a real model for predict/plot etc. from a Random Forest model?
I tried the function getTree() which could generate a data frame of one specific tree, but one cannot use it as a model to predict new data.
I know RF is an ensemble learning algorithm, however, for my purpose, I need each decision tree as a practical model for other usages. Thanks.

## closed as off-topic by Sycorax, kjetil b halvorsen, hxd1011, mdewey, JohnNov 17 '16 at 6:06

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – Sycorax, kjetil b halvorsen, hxd1011, mdewey, John
If this question can be reworded to fit the rules in the help center, please edit the question.

Just use the option to return the predictions from all trees. If your random forest object is rf:
predict(rf, newdata=foo, predict.all=TRUE)