title: How do you plot a CostSensitiveClassifier tree in R?
body: <p>In this case I'm using the RWeka package and J48 within the Cost Sensitive Classifier function. I know with the package "party" I can plot a normal J48 tree, but not sure how to get a plot with the CSC output.</p>
  
  <pre><code>library(RWeka)
  
  csc &lt;- CostSensitiveClassifier(Species ~ ., data = iris, 
  control = Weka_control(`cost-matrix` = matrix(c(0,10, 0, 0, 0, 0, 0, 10, 0), 
  ncol = 3), 
  W = "weka.classifiers.trees.J48", 
  M = TRUE))
  
  csc
  CostSensitiveClassifier using minimized expected misclasification cost
  
  weka.classifiers.trees.J48 -C 0.25 -M 2
  
  Classifier Model
  J48 pruned tree
  ------------------
  
  Petal.Width &lt;= 0.6: setosa (50.0)
  Petal.Width &gt; 0.6
  |   Petal.Width &lt;= 1.7
  |   |   Petal.Length &lt;= 4.9: versicolor (48.0/1.0)
  |   |   Petal.Length &gt; 4.9
  |   |   |   Petal.Width &lt;= 1.5: virginica (3.0)
  |   |   |   Petal.Width &gt; 1.5: versicolor (3.0/1.0)
  |   Petal.Width &gt; 1.7: virginica (46.0/1.0)
  
  Number of Leaves  :     5
  
  Size of the tree :  9
  
  
  Cost Matrix
    0  0  0
   10  0 10
    0  0  0
  plot(csc)
  </code></pre>
  
  <blockquote>
    <p>Error in xy.coords(x, y, xlabel, ylabel, log) : 
      'x' is a list, but does not have components 'x' and 'y'</p>
  </blockquote>
  
  <p>Any help would be great.</p>
  
  <pre><code>dput(csc)
  
  structure(list(classifier = &lt;S4 object of class structure("jobjRef", package = "rJava")&gt;, 
      predictions = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
      1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
      1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
      1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 
      2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
      2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
      2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
      2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
      2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
      2L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
      2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("setosa", "versicolor", 
      "virginica"), class = "factor"), call = CostSensitiveClassifier(formula = Species ~ 
          ., data = iris, control = Weka_control(`cost-matrix` = matrix(c(0, 
          10, 0, 0, 0, 0, 0, 10, 0), ncol = 3), W = "weka.classifiers.trees.J48", 
          M = TRUE)), handlers = structure(list(control = list(
          function (x) 
          {
              if (inherits(x, "Weka_control")) {
                  ind &lt;- which(names(x) %in% substring(options, 
                    2L))
                  if (any(ind)) 
                    x[ind] &lt;- lapply(x[ind], fun, ...)
              }
              else {
                  x &lt;- as.character(x)
                  ind &lt;- which(x %in% options)
                  if (any(ind)) 
                    x[ind + 1L] &lt;- sapply(x[ind + 1L], fun, ...)
              }
              x
          }, function (x) 
          {
              if (inherits(x, "Weka_control")) {
                  ind &lt;- which(names(x) %in% substring(options, 
                    2L))
                  if (any(ind)) 
                    x[ind] &lt;- lapply(x[ind], fun, ...)
              }
              else {
                  x &lt;- as.character(x)
                  ind &lt;- which(x %in% options)
                  if (any(ind)) 
                    x[ind + 1L] &lt;- sapply(x[ind + 1L], fun, ...)
              }
              x
          }), data = function (mf) 
      {
          terms &lt;- attr(mf, "terms")
          if (any(attr(terms, "order") &gt; 1L)) 
              stop("Interactions are not allowed.")
          factors &lt;- attr(terms, "factors")
          varnms &lt;- rownames(factors)[c(TRUE, rowSums(factors)[-1L] &gt; 
              0)]
          mf[, sub("^`(.*)`$", "\\1", varnms), drop = FALSE]
      }), .Names = c("control", "data")), levels = c("setosa", 
      "versicolor", "virginica"), terms = Species ~ Sepal.Length + 
          Sepal.Width + Petal.Length + Petal.Width), .Names = c("classifier", 
  "predictions", "call", "handlers", "levels", "terms"), class = c("CostSensitiveClassifier", 
  "Weka_meta", "Weka_classifier"))
  </code></pre>