Adding percentage labels to a bar chart in ggplot2
<p>How can I use <code>geom_text</code> to add percentage labels on top of each bar in <code>ggplot2</code>? I know there are several similar questions which are already answered. But they either use only 1 categorical variable or compute the percentages before plotting.<br>
I have following plot:  </p>

<pre><code>ggplot(data = mtcars)+
  geom_bar(aes(x = factor(cyl), 
               y = (..count..)/sum(..count..)*100,
               fill = factor(gear)),
           position = "dodge")  
</code></pre>

<p>Now I want to add the percentage labels on the top. If I use <code>y = (..count..)/sum(..count..)*100</code> in <code>geom_text</code>, it says <code>Error in eval(expr, envir, enclos) : object 'count' not found</code>.</p>