title: Remove Unused categorical values boxplot - R
body: <p>I have the following code:</p>
  
  <pre><code>x = rnorm(30, 1, 1)
  c = c(rep("x1",10), rep("x2",10), rep("x3",10))
  df = dataframe(x,c)
  boxplot(x ~ c, data=df)
  </code></pre>
  
  <p>It works great.  But if I decide I am no longer interested in seeing x3, remove it, and replot:</p>
  
  <pre><code>dfMod = subset(df, c %in% c("x1", "x2"))
  boxplot(x ~ c,data=dfMod)
  </code></pre>
  
  <p>The boxplot still shows a column for x3.</p>
  
  <p><img src="https://i.stack.imgur.com/XQoT9.png" alt="enter image description here"></p>
  
  <p>Ive tried giving boxplot a hint using</p>
  
  <pre><code>boxplot(x~c,data=dfMod, names = c("x1", "x2"))
  </code></pre>
  
  <p>but this throws the error that names size is not right.  Thanks in advance for the help</p>