plot one of 500 trees in randomForest package
问题 How can plot trees in output of randomForest function in same names packages in R? For example I use iris data and want to plot first tree in 500 output tress. my code is model <-randomForest(Species~.,data=iris,ntree=500) 回答1: You can use the getTree() function in the randomForest package (official guide: https://cran.r-project.org/web/packages/randomForest/randomForest.pdf) On the iris dataset: require(randomForest) data(iris) ## we have a look at the k-th tree in the forest k <- 10 getTree