title: In Random Forest - how can I attach the prediction results to the data frame
body: <p>I would like to use random forest for classification but there are two things that I can't find a solution for: the first one is how can I attach the prediction results to the data frame. Second, how can I get more insights (charts,statistics,etc..) other than a contingency table on the quality of the prediction? 
  Here is my data frame example:</p>
  
  <pre><code>dat &lt;- read.table(text = " TargetVar  Var1    Var2       Var3
   0        0        0         7
   0        0        1         1
   0        1        0         3
   0        1        1         7
   1        0        0         5
   1        0        1         1
   1        1        0         0
   1        1        1         6
   0        0        0         8
   0        0        1         5
   1        1        1         4
   0        0        1         2
   1        0        0         9
   1        1        1         2  ", header = TRUE)
  
  dat$dat$TargetVar &lt;- as.factor(dat$TargetVar) #changed my target variable into a factor
  rf &lt;- randomForest(TargetVar~Var1 + Var2+ Var3 ,data=dat,ntree=10,importance=TRUE) #produced the model
  table(predict(rf),dat$TargetVar) # got the contingency table
  </code></pre>
  
  <p>thanks.</p>