title: Error: $ operator is invalid for atomic vectors using ggplot2
body: <p>I am a running a linear mixed model analyses using the nlme package in R.<br>
  I get the above error when I try to plot the results from my model using ggplot. I have looked at other posts on stackoverflow but cant seem to see what the error is here.   PLease could someone help with the sample data below?</p>
  
  <p>My code is as follows:  </p>
  
  <pre><code>m1&lt;-lme(vis_hits~Group*session+nbacklevel, random=~session|subjno,
                data = sampledata,method="ML",na.action=na.omit)
      summary(m1)
  
  m1_plot&lt;ggplot(sampledata,aes(session,vis_hits,colour=Group))+
             stat_summary(fun.data=mean_se,geom="pointrange")+
             stat_summary(aes(y=fitted(m1),linetype=Group),fun.y=mean,geom="line",size=1.5)+
             labs(y="Correctly detected nbacks")
  </code></pre>
  
  <p>A sample of my data is below  </p>
  
  <pre><code>Subjno  Group   session nbacklevel  vis_hits
  1   1   1   1   0.83
  1   1   1   2   0.5
  1   1   1   3   0.33
  1   1   1   3   
  1   1   2   1   0.67
  1   1   2   2   0.5
  1   1   2   3   0.17
  1   1   2   2   0.17
  1   1   2   2   0.5
  1   1   2   2   0.33
  1   1   2   2   0.33
  1   1   2   2   0.5
  1   1   2   2   0.33
  1   1   2   2   
  1   1   2   1   0.67
  1   1   2   2   0.67
  1   1   2   3   0.33
  1   1   2   3   0.33
  1   1   2   3   0.17
  1   1   3   1   0.67
  1   1   3   2   0.5
  1   1   3   2   0.5
  1   1   3   2   0.33
  1   1   3   2   0.33
  1   1   3   2   0.5
  1   1   3   2   0.33
  1   1   3   2   0.33
  1   1   3   2   0.17
  1   1   3   2   0.33
  1   1   3   2   0.33
  1   1   3   2   0.67
  1   1   3   3   0.17
  1   1   3   3   0.17
  1   1   3   3   0.17
  1   1   3   3   0.17
  1   1   4   1   1
  1   1   4   2   1
  1   1   4   3   0.5
  1   1   4   2   1
  1   1   4   3   0.67
  1   1   4   3   0.5
  1   1   4   2   1
  1   1   4   3   0.67
  1   1   4   4   0.67
  1   1   4   3   0.67
  1   1   4   2   0.83
  1   1   4   3   1
  1   1   4   4   0.67
  1   1   5   2   0.83
  1   1   5   3   0.33
  1   1   5   3   0.33
  1   1   6   2   0.83
  1   1   6   3   0.5
  1   1   6   3   0.67
  1   1   6   3   0.17
  2   0   1   1   1
  2   0   1   2   1
  2   0   1   2   1
  2   0   2   1   1
  2   0   2   2   1
  2   0   2   3   0.83
  2   0   2   2   1
  2   0   2   3   0.83
  2   0   2   2   1
  2   0   2   2   0.83
  2   0   2   2   1
  2   0   2   2   1
  2   0   2   3   0.83
  2   0   2   2   1
  2   0   2   3   0.5
  2   0   2   2   1
  2   0   3   1   1
  2   0   3   2   1
  2   0   3   3   0.83
  2   0   3   2   1
  2   0   3   2   1
  2   0   3   2   1
  2   0   3   2   1
  2   0   3   3   0.33
  2   0   3   2   0.67
  2   0   3   2   1
  2   0   3   2   0.83
  2   0   3   2   1
  2   0   3   3   0.83
  2   0   3   2   1
  2   0   4   1   1
  2   0   4   2   1
  2   0   4   3   0.33
  2   0   4   2   1
  2   0   4   3   0.67
  2   0   4   2   1
  2   0   4   3   0.67
  2   0   4   2   0.5
  2   0   4   1   0.83
  2   0   4   1   0.83
  2   0   4   1   0.83
  2   0   4   2   1
  2   0   4   3   0.33
  2   0   4   2   0.83
  2   0   5   2   0.5
  2   0   5   1   1
  2   0   5   2   0.83
  2   0   5   2   0.83
  2   0   6   2   1
  2   0   6   3   0.67
  2   0   6   2   1
  2   0   6   3   0.83
  2   0   6   3   0.83
  3   1   1   1   0.67
  3   1   1   2   0.67
  3   1   1   3   0.33
  3   1   1   3   0.33
  3   1   2   1   0.67
  3   1   2   2   0.33
  3   1   2   1   0.83
  3   1   2   2   1
  3   1   2   3   0.33
  3   1   2   2   0.67
  3   1   2   2   0.67
  3   1   2   3   
  3   1   2   2   0.5
  3   1   2   2   0.5
  3   1   2   2   0.67
  3   1   2   2   0.67
  3   1   2   2   1
  3   1   2   3   0.5
  3   1   2   2   0.83
  3   1   3   1   0.83
  3   1   3   2   0.67
  3   1   3   2   0.67
  3   1   3   3   0.17
  3   1   3   2   1
  3   1   3   3   0.5
  3   1   3   3   0.67
  3   1   3   3   0.5
  3   1   3   2   0.83
  3   1   3   3   0.33
  3   1   3   2   1
  3   1   3   3   0.67
  3   1   3   3   0.67
  3   1   3   3   0.5
  3   1   3   3   0.33
  3   1   4   1   0.83
  3   1   4   2   0.67
  3   1   4   3   0.5
  3   1   4   2   1
  3   1   4   3   0.33
  3   1   4   3   0.67
  3   1   4   3   0.83
  3   1   4   4   0.33
  3   1   4   3   0.33
  3   1   4   2   0.5
  3   1   4   2   1
  3   1   4   3   0.33
  3   1   4   3   0.17
  3   1   4   2   1
  3   1   4   3   0.33
  3   1   5   2   1
  3   1   5   3   0.67
  3   1   5   3   0.33
  3   1   6   2   0.17
  3   1   6   1   1
  3   1   6   2   0.83
  3   1   6   3   0.83
  3   1   6   4   0.17
  3   1   6   4   0.5
  4   0   1   1   1
  4   0   1   2   0.5
  4   0   1   2   0.5
  4   0   2   1   1
  4   0   2   2   0.5
  4   0   2   2   0.5
  4   0   2   2   1
  4   0   2   3   0.5
  4   0   2   3   0.67
  4   0   2   3   0.33
  4   0   2   3   0.33
  4   0   2   3   0.5
  4   0   2   3   0.17
  4   0   2   3   0.67
  4   0   2   3   0.33
  4   0   2   3   0.67
  4   0   3   1   1
  4   0   3   2   1
  4   0   3   3   0.5
  4   0   3   3   0.5
  4   0   3   2   0.67
  4   0   3   2   0.67
  4   0   3   2   0.67
  4   0   3   2   0.67
  4   0   3   2   0.67
  4   0   3   2   0.33
  4   0   3   2   0.5
  4   0   3   2   0.17
  4   0   3   3   0.33
  4   0   4   1   1
  4   0   4   2   0.67
  4   0   4   2   0.67
  4   0   4   3   0.33
  4   0   4   3   0.5
  4   0   4   2   0.5
  4   0   4   2   0.5
  4   0   4   2   0.83
  4   0   4   3   0.17
  4   0   4   2   0.5
  4   0   4   2   0.33
  4   0   4   1   1
  4   0   4   2   0.5
  4   0   4   2   1
  4   0   5   1   1
  4   0   5   2   1
  4   0   5   3   0.33
  4   0   5   2   0.5
  4   0   6   2   0.5
  4   0   6   2   0.5
  4   0   6   2   0.5
  4   0   6   3   
  6   0   1   1   1
  6   0   1   2   1
  6   0   1   3   0.67
  6   0   1   2   0.83
  6   0   2   1   1
  6   0   2   2   1
  6   0   2   3   0.17
  6   0   2   2   1
  6   0   2   3   0.67
  6   0   2   3   0.83
  6   0   2   3   0.67
  6   0   2   2   1
  6   0   2   3   1
  6   0   2   4   0.5
  6   0   3   1   1
  6   0   3   2   1
  6   0   3   3   0.5
  6   0   3   2   1
  6   0   3   3   0.67
  6   0   3   3   0.5
  6   0   3   2   1
  6   0   3   3   0.67
  6   0   3   4   0.67
  6   0   3   3   0.67
  6   0   3   2   0.83
  6   0   3   3   1
  6   0   3   4   0.67
  6   0   4   2   1
  6   0   4   3   0.67
  6   0   4   3   0.67
  6   0   4   3   1
  6   0   4   4   0.33
  6   0   4   3   0.67
  6   0   4   3   0.83
  6   0   4   2   1
  6   0   4   3   1
  6   0   4   4   0.67
  6   0   4   3   1
  6   0   4   4   0.5
  6   0   4   3   0.67
  6   0   5   2   1
  6   0   5   3   1
  6   0   5   4   0.5
  6   0   6   2   0.83
  6   0   6   3   1
  6   0   6   4   0.83
  6   0   6   4   0.83
  </code></pre>