title: Invalid object" error in boxplot in r
body: <p>I have three variables which are factors: stimulus (12 levels), match (2 levels  and Listgp (3 levels: T, TA and TQ). I already split the Listgp (Listener group) into three subset dataframes as follows. </p>
  
  <pre><code>mydata1T &lt;-mydata[mydata$Listgp == "T", ]
  mydata1TA &lt;-mydata[mydata$Listgp == "TA", ]
  mydata1TQ &lt;-mydata[mydata$Listgp == "TQ", ]
  </code></pre>
  
  <p>Then I cross tabulated <code>stimulusXmatch</code> for each of the groups and even plotted them using <code>barplot()</code> and everything works just fine. However, when I try to use boxplot() in the lattice package, I get the error </p>
  
  <pre><code>(Error in boxplot.default(split(mf[[response]], mf[-response]), ...) 
   adding class "factor" to an invalid object).
  </code></pre>
  
  <p>The syntax I used is as follows. </p>
  
  <pre><code>par(mfrow=c(1,3))
  boxplot(mydata1T$stimulus~mydata1T$match, data=mydata)
  boxplot(mydata1TA$stimulus~mydata1TA$match, data=mydata)
  boxplot(mydata1TA$stimulus~mydata1TQ$match, data=mydata)
  par(mfrow=c(1,1))
  </code></pre>
  
  <p>How can I solve this problem and create three boxplots for the three group of listeners?</p>