title: Error box.col: illegal value on fancyRpartPlot() and rpart.plot() in R
body: <p>I am practising the tutorial of 'Titanic: Machine Learning from Disaster' from kaggle.<br>
  Could someone please help me with this error ? Its same for the function rpart.plot(fit) and fancyRpartPlot(fit) and example(rpart.plot), While plot(fit) is working fine.                             </p>
  
  <pre><code>fancyRpartPlot(fit) Error: box.col: illegal value
  fit is : fit &lt;- rpart(Survived ~ Sex, data=train, method="class")
  </code></pre>
  
  <p>I tried the following:
  Followed exact steps as in the implementation in github page (<a href="https://github.com/trevorstephens/titanic/blob/master/Tutorial3.R" rel="nofollow noreferrer">https://github.com/trevorstephens/titanic/blob/master/Tutorial3.R</a>).</p>
  
  <p>Uninstalled and installed the entire R and the added packages.</p>
  
  <p>I tried to debug fancyRpartPlot() and in the function, where  </p>
  
  <pre><code>box.col = pals[col.index],
  pals : chr[1:30] "#F7FCF5" "E5F5E0" "#C7E9C0" .......so on
  col.index : num[1:3] 4 5 9
  </code></pre>
  
  <p>box.col will have these values based on index: "#A1D99B" "#74C476" "#9ECAE1"<br>
  I tried alot to clear this issue, may be a little problem. What is that i am missing?</p>
  
  <p>print(fit):   </p>
  
  <pre><code>n= 891
  node), split, n, loss, yval, (yprob)
    * denotes terminal node
  1) root 891 342 0 (0.6161616 0.3838384)
  2) Sex=male 577 109 0 (0.8110919 0.1889081) *
  3) Sex=female 314  81 1 (0.2579618 0.7420382) *
  </code></pre>
  
  <p>traceback():    </p>
  
  <pre><code>6: stop(..., call. = FALSE) 
  5: stop0(deparse(substitute(object)), ": illegal value")
  4: is.specified(box.col)
  3: handle.box.palette.args(obj, trace, box.col, box.palette, pal.thresh, 
     pal.node.fun, node.fun.name, class.stats, node.labs)
  2: rpart.plot::prp(model, type = 2, extra = extra, box.col = pals[col.index], 
     nn = TRUE, varlen = 0, faclen = 0, shadow.col = "grey", fallen.leaves = TRUE, 
     branch.lty = 3, ...)
  1: fancyRpartPlot(fit)
  </code></pre>
  
  <p>sessionInfo():                                       </p>
  
  <pre><code>R version 3.0.2 (2013-09-25)
  Platform: x86_64-pc-linux-gnu (64-bit)
  locale:
  [1] LC_CTYPE=en_IN.UTF-8         LC_NUMERIC=C   LC_TIME=en_IN.UTF-8
  [4] LC_COLLATE=en_IN.UTF-8     LC_MONETARY=en_IN.UTF-8    LC_MESSAGES=en_IN.UTF-8 
  [7] LC_PAPER=en_IN.UTF-8       LC_NAME=C                  LC_ADDRESS=C
  [10] LC_TELEPHONE=C             LC_MEASUREMENT=en_IN.UTF-8 LC_IDENTIFICATION=C
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base
  other attached packages:
  [1] RColorBrewer_1.1-2 rpart.plot_2.1.1   rattle_4.1.0       rpart_4.1-10
  loaded via a namespace (and not attached):
  [1] magrittr_1.5  RGtk2_2.20.31 stringi_1.1.5 tools_3.0.2 
  </code></pre>
  
  <p>example(rpart.plot):</p>
  
  <pre><code>rprt.p&gt; old.par &lt;- par(mfrow=c(2,2))                    # put 4 figures on one page
  rprt.p&gt; data(ptitanic)
  rprt.p&gt; #---------------------------------------------------------------------------
  rprt.p&gt;
  rprt.p&gt; binary.model &lt;- rpart(survived ~ ., data=ptitanic, cp=.02)
  rprt.p&gt;                                         # cp=.02 for small demo tree
  rprt.p&gt;
  rprt.p&gt; rpart.plot(binary.model,
  rprt.p+            main="titanic survived\n(binary response)")
  Error: box.col: illegal value
  </code></pre>