# 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.

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)