title: How to plot final c50 decision tree model (library C50) from caret::train object
body: <p>I trained <strong>Decision Tree</strong> model using <strong>train</strong> function from <strong>caret</strong> library:</p>
  
  <pre><code>gr = expand.grid(trials = c(1, 10, 20), model = c("tree", "rules"), winnow = c(TRUE, FALSE))
  dt = train(y ~ ., data = train, method = "C5.0", trControl = trainControl(method = 'cv', number = 10), tuneGrid = gr)
  </code></pre>
  
  <p>Now I would like to plot <strong>Decision Tree</strong> for the final model. But this command doesn't work:</p>
  
  <pre><code>plot(dt$finalModel)
  
  Error in data.frame(eval(parse(text = paste(obj$call)[xspot])), eval(parse(text = paste(obj$call)[yspot])),  : 
    arguments imply differing number of rows: 4160, 208, 0
  </code></pre>
  
  <p>Someone already asked about it here: <a href="https://github.com/topepo/caret/issues/855" rel="nofollow noreferrer">topic</a></p>
  
  <p>Suggested solution was to use <strong>bestTune</strong> from the fitted <strong>train</strong> object to define the relevant <strong>c5.0 model</strong> manually. And then plot that <strong>c5.0 model</strong> normally:</p>
  
  <pre><code>c5model = C5.0(x = x, y = y, trials = dt$bestTune$trials, rules = dt$bestTune$model == "rules", control = C5.0Control(winnow = dt$bestTune$winnow))
  plot(c5model)
  </code></pre>
  
  <p>I tried to do so. Yes, it makes possible to plot <strong>c5.0 model</strong>, <strong>BUT</strong> predicted probabilities from <strong>train</strong> object and manually recreated <strong>c5.0 model</strong> don't match. </p>
  
  <p>So, my question is: is it possible to extract final <strong>c5.0 model</strong> from <strong>caret::train</strong> object and plot this <strong>Decision Tree</strong>?</p>