title: Summarising Data in R
body: <p>I'm sure this is really easy, but as an R novice I'm tearing my hair out.</p>
  
  <p>I have a data frame:</p>
  
  <pre><code>df &lt;- data.frame("Factor_1" = c(1,2,1,1,2,1,1,2,1,2,1,2),
                   "Factor_2" = c("M", "F", "M", "F","M", "F","M", "F","M", "F","M", "F"),
                   "Denominator" = c(1,1,1,1,1,1,1,1,1,1,1,1),
                   "Numerator" = c(0,0,1,0,0,0,1,0,0,0,1,1))
  </code></pre>
  
  <p>I want to create some graphs:</p>
  
  <pre><code>(1) Sum(Denominator) - split by Factor_1
  (2) Sum(Numerator)/Sum(Denominator) - split by Factor_1
  
  (so Factor_1 appears on the horizontal axis)
  
  (and then repeat for Factor_2)
  </code></pre>
  
  <p>Ideally with (1) and (2) having different vertical axes and with (1) as columns and (2) as lines.</p>
  
  <p>Would look a bit like the attached picture (from an Excel pivot table/graph):</p>
  
  <p><a href="https://i.stack.imgur.com/8wSRk.png" rel="nofollow noreferrer">Pivot Graph</a></p>