How to actually plot a sample tree from randomForest::getTree()? Anyone got library or code suggestions on how to actually plot a couple of sample trees from: 
getTree(rfobj, k, labelVar=TRUE)

(Yes I know you're not supposed to do this operationally, RF is a blackbox, etc etc. I want to visually sanity-check a tree to see if any variables are behaving counterintuitively, need tweaking/combining/discretization/transformation, check how well my encoded factors are working, etc.)

Prior questions without a decent answer: 


*

*How to make Random Forests more interpretable?

*Also Obtaining knowledge from a random forest
I actually want to plot a sample tree. So don't argue with me about that, already. I'm not asking about varImpPlot(Variable Importance Plot) or partialPlot or MDSPlot, or these other plots, I already have those, but they're not a substitute for seeing a sample tree.
Yes I can visually inspect the output of getTree(...,labelVar=TRUE).
(I guess a plot.rf.tree() contribution would be very-well-received.)
 A: I'm four years late, but if you really want to stick to the randomForest package (and there are some good reasons to do so), and want to actually visualize the tree, you can use the reprtree package.
The package is not super well documented (you can find the docs here), but everything is pretty straightforward. To install the package refer to initialize.R in the repo, so simply run the following:
options(repos='http://cran.rstudio.org')
have.packages <- installed.packages()
cran.packages <- c('devtools','plotrix','randomForest','tree')
to.install <- setdiff(cran.packages, have.packages[,1])
if(length(to.install)>0) install.packages(to.install)

library(devtools)
if(!('reprtree' %in% installed.packages())){
   install_github('munoztd0/reprtree')
}
for(p in c(cran.packages, 'reprtree')) eval(substitute(library(pkg), list(pkg=p)))

Then go ahead and make your model and tree:
library(randomForest)
library(reprtree)

model <- randomForest(Species ~ ., data=iris, importance=TRUE, ntree=500, mtry = 2, do.trace=100)

reprtree:::plot.getTree(model)

And there you go! Beautiful and simple.

You can check the github repo to learn about the other methods in the package. In fact, if you check plot.getTree.R, you'll notice that the author uses his own implementation of as.tree() which chl♦ suggested you could build yourself in his answer. This means that you could do this:
tree <- getTree(model, k=1, labelVar=TRUE)
realtree <- reprtree:::as.tree(tree, model)

And then potentially use realtree with other tree plotting packages such as tree.
A: I've created some functions to extract the rules of a tree.
#***********************
#return the rules of a tree
#***********************
getConds<-function(tree){
  #store all conditions into a list
  conds<-list()
  #start by the terminal nodes and find previous conditions
  id.leafs<-which(tree$status==-1)
   j<-0
   for(i in id.leafs){
  j<-j+1
  prevConds<-prevCond(tree,i)
  conds[[j]]<-prevConds$cond
  while(prevConds$id>1){
    prevConds<-prevCond(tree,prevConds$id)
    conds[[j]]<-paste(conds[[j]]," & ",prevConds$cond)
        }
  if(prevConds$id==1){
   conds[[j]]<-paste(conds[[j]]," => ",tree$prediction[i])
    }
    
  }
  
  return(conds)
}

#**************************
#find the previous conditions in the tree
#**************************
prevCond<-function(tree,i){
  if(i %in% tree$right_daughter){
  id<-which(tree$right_daughter==i)
  cond<-paste(tree$split_var[id],">",tree$split_point[id])
   }
   if(i %in% tree$left_daughter){
    id<-which(tree$left_daughter==i)
  cond<-paste(tree$split_var[id],"<",tree$split_point[id])
  }
  
  return(list(cond=cond,id=id))
}

#remove spaces in a word
collapse<-function(x){
  x<-sub(" ","_",x)
  
  return(x)
}


data(iris)
require(randomForest)
mod.rf <- randomForest(Species ~ ., data=iris)
tree<-getTree(mod.rf, k=1, labelVar=TRUE)
#rename the name of the column
colnames(tree)<-sapply(colnames(tree),collapse)
rules<-getConds(tree)
print(rules)

