title: ROC Curve in R with rpart for a decision tree
body: <p>I have an issue with creating a ROC Curve for my decision tree created by the rpart package. 
  My goal was to predict "y" the success of the bank's marketing campaign. In the end, you can get a "yes" or a "no" as a possible answer. 
  How can I approach my next step the ROC curve plot?</p>
  
  <p>Here is the R code I have so far:</p>
  
  <pre><code>library(caTools) 
  library(rpart) 
  library(rpart.plot) 
  
  set.seed(1234) 
  sample = sample.split(bank$y, SplitRatio = .75) 
  train = subset(bank, sample==TRUE) 
  test = subset(bank, sample==FALSE)
  
  tree &lt;-rpart(y ~.,method="class",data=train) 
  tree.preds&lt;-predict(tree, test)
  tree.preds&lt;-as.data.frame(tree.preds) 
  joiner &lt;- function(x) {if (x &gt;= 0.5) {return("Yes") } else {return("No")}}
  tree.preds$y &lt;- sapply(tree.preds$yes, joiner) 
  table(tree.preds$y, test$y) 
  prp(tree) 
  </code></pre>