title: Argument for "n" when plotting with ggplot2
body: <p>I am fairly new to R (coming from a Stata-background) and I am finding difficult to deal with some arguments when plotting with ggplot2. Please consider the following:</p>
  
  <pre><code>test &lt;- data.frame(
    time=c(1,2,3,1,2,3,1,2,3),
    experiment=c(2,1,2,1,1,2,1,2,2)
  )
  
  test$time2 &lt;- factor(test$time,
    levels=c("1","2","3"),
    labels=c("R1", "R2", "R3")
  )
  
  test$experiment2 &lt;- factor(test$experiment,
                             levels=c(1,2),
                             labels=c("Yes", "No")
                             )
  
  ggplot(test, aes(test$time2, ..count../3))+
    geom_bar(aes(fill=test$experiment2))+
    scale_y_continuous(labels=percent)
  </code></pre>
  
  <p>The above is just a silly example I just made up to ask about how to use "n" (number of observations) properly. If you reproduce the code above you will see that it graphs a stacked barplot (percentages). However, to make it I had to manually do: ..count../3</p>
  
  <p>What I would like to find out in R is how to substitute that "3" by a generic argument. Looking on the Internet could not find anything, and tentatively I tried "N" and "n" to no avail. Thanks a lot for your help, the move from Stata to R is exciting but not as easy as one would think. </p>