title: can't draw the grouped value above stacked bar plot in ggplot2
body: <p>I have a ggplot2 question, I run the code below show the stacked barplot without add value above each bar correctly:</p>
  
  <pre><code>p=ggplot(data=essnn) 
    p+geom_bar(binwidth=0.5,stat="identity")+  #
    aes(x=reorder(classname,-amount,sum), y=amount, label=amount, fill = sort(year))+
    theme()
  </code></pre>
  
  <p><img src="https://imgur.com/BYpTOrR.jpg" alt="picture"></p>
  
  <p>I want add the sum amount grouped by year in each class, and here is my code:</p>
  
  <p><code>+geom_text(aes(x=classes,y=total,label=total), data=essnnta, fill=NULL, size=3)</code> </p>
  
  <p>But an error message appear:</p>
  
  <pre><code>Error in fill = year, can not find object "year"
  </code></pre>
  
  <p>That's my problem: <strong>why the object "year" can be found when I draw stack bar plot without add the sum amount grouped by year in each class, but when I add the sum amount grouped by year, the error appear</strong>?</p>
  
  <pre><code>&gt; str(essnn)
      'data.frame':   48619 obs. of  15 variables:
       $ id       : int  2006051337 2006051337 2006051337 2006051337 2006051337 2006051337 2004070648 2006031360 2006031360 2004070062 ...
       $ gender   : Factor w/ 3 levels "","F","M": 3 3 3 3 3 3 3 3 3 3 ...
       $ age      : num  30 30 30 30 30 30 38 43 43 37 ...
       $ class    : Factor w/ 92 levels "100ab","100aa",..: 18 18 18 18 18 18 18 18 18 18 ...
       $ classname: Factor w/ 1136 levels "cad"," Office2010",..: 111 111 111 111 111 111 116 107 107 107 ...
       $ grade    : num  7 5 6 8 3 4 1 4 3 2 ...
       $ year     : Factor w/ 6 levels "98","99","100",..: 3 3 3 3 2 2 4 5 5 3 ...
       $ ses      : num  212 210 211 213 207 208 217 221 220 210 ...
       $ date     : int  1010421 1001115 1010214 1010701 1000411 1000627 1020424 1030304 1021121 1001108 ...
       $ money    : num  5800 5800 5800 5800 5200 5200 3000 0 5500 5500 ...
       $ discount : num  1160 1160 1160 1160 1040 1040 600 0 275 550 ...
       $ amount   : num  4640 4640 4640 4640 4160 ...
       $ idc      : Factor w/ 7 levels "在校生","校友",..: 2 2 2 2 2 2 2 7 7 7 ...
       $ mdy      : Date, format: "2012-04-21" "2011-11-15" "2012-02-14" "2012-07-01" ...
       $ day      : num  1123 1281 1190 1052 1499 ...
  
  &gt; str(essnnta)
          'data.frame':   10 obs. of  2 variables:
           $ classes: Factor w/ 10 levels "JD","JF",..: 1 7 8 4 6 10 3 5 2 9
           $ total  : num  55603526 43708950 43555010 35649129 33214372 ...
  </code></pre>