title: ggplot2 - Multi-group histogram with in-group proportions rather than frequency
body: <p>I have three cohorts of students identified by an <code>ExperimentCohort</code> factor. For each student, I have a <code>LetterGrade</code>, also a factor. I'd like to plot a histogram-like bar graph of <code>LetterGrade</code> for each <code>ExperimentCohort</code>. Using</p>
  
  <pre><code>ggplot(df, alpha = 0.2, 
         aes(x = LetterGrade, group = ExperimentCohort, fill = ExperimentCohort))                                                                                                                                                       
    + geom_bar(position = "dodge")
  </code></pre>
  
  <p>gets me very close, but the three <code>ExperimentCohorts</code> don't have the same number of students. To compare these on a more even field, I'd like the y-axis to be the in-cohort proportion of each letter-grade. So far, short of calculating this proportion and putting it in a separate dataframe before plotting, I have not been able to find a way to do this. </p>
  
  <p>Every solution to a similar question on SO and elsewhere involves <code>aes(y = ..count../sum(..count..))</code>, but sum(..count..) is executed across the whole dataframe rather than within each cohort. Anyone got a suggestion? Here's code to create an example dataframe:</p>
  
  <pre><code>df &lt;- data.frame(ID = 1:60, 
          LetterGrade = sample(c("A", "B", "C", "D", "E", "F"), 60, replace = T),
          ExperimentCohort = sample(c("One", "Two", "Three"), 60, replace = T))
  </code></pre>
  
  <p>Thanks.</p>