title: Multi-group histogram with group-specific frequencies
body: <p>First off, I've already read the following thread: <a href="https://stackoverflow.com/questions/17368223/ggplot2-multi-group-histogram-with-in-group-proportions-rather-than-frequency">ggplot2 - Multi-group histogram with in-group proportions rather than frequency</a></p>
  
  <p>I followed the ddply suggestion and it didn't seem to work for my data. Logically the code should work perfectly on my dataset and I have no idea what I'm doing wrong.</p>
  
  <p>Overall: I'd like to make a histogram (I'm learning ggplot) that displays the genotype frequency in each of my study groups. </p>
  
  <p>Something like this:</p>
  
  <p><a href="https://i.stack.imgur.com/XD6ZD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XD6ZD.png" alt="enter image description here"></a></p>
  
  <p>Here's a mock data set that mirrors my own:</p>
  
  <pre><code>df&lt;-data.frame(ID=1:60,
                 Genotypes=sample(c("CG", "CC", "GG"), 60, replace=T),
                 Study_Group=sample(c("Control", "Pathology1", "pathology2"), 60, replace=T))
  </code></pre>
  
  <p>I've tried variants of <code>p + geom_bar(aes(aes(y = ..count../sum(..count..))</code> but r returns  "cannot find 'count' object" or something to that effect.</p>
  
  <p>I also tried:</p>
  
  <pre><code>df.new&lt;-ddply(df,.(Study_Group),summarise,
                prop=prop.table(table(df$Genotype)),
                Genotype=names(table(df$Genotype)))`
  </code></pre>
  
  <p>And I believe there was an error with the summarise function, but to be honest, I have no idea what I'm doing.</p>
  
  <p>Is the problem simply my comprehension of the solution or is it something inherently different in my data set?</p>
  
  <p>Thanks for the help.</p>