title: Summing overlapping rows from a single column in R
body: <p>I am trying to sum values from the same column across multiple rows in R, but each row falls into 1 or 2 of the desired output rows, so I have struggled to use <code>ddply</code> or <code>tapply</code> successfully.</p>
  
  <p>I have triangular transect data, where sample points were taken at each vertex (points 1, 3 and 5) and half-way along each edge (points 2, 4 and 6). I am trying to summarise the data collected along each side of the triangle: i.e. leg A is the sum of points 1 + 2 + 3; leg B is the sum of points 3 + 4 + 5; leg C is the sum of points 5 + 6 + 1.</p>
  
  <p>My data is in the form:</p>
  
  <pre><code>Transect &lt;- c(rep("T001",6),rep("T002",6),rep("T003",6))
  Point &lt;- rep(seq(1,6,1),3)
  Area &lt;- c(rep(3000, 8), 2500, 2000, rep(3000,4), 1000, rep(3000,3))
  df &lt;- data.frame(Transect, Point, Area)
  </code></pre>
  
  <p>The desired output would be:</p>
  
  <pre><code>Transect2 &lt;- c(rep("T001",3),rep("T002",3),rep("T003",3))
  Leg &lt;- rep(c("A", "B", "C"),3)
  Total.Area &lt;- c(rep(9000,3), 8500, 7500, 9000, 7000, 7000, 9000)
  df.out &lt;- data.frame(Transect2, Leg, Total.Area)
  </code></pre>
  
  <p>Thanks in advance for your help, and apologies if the question title is poorly worded, I'm not sure how to accurately describe this problem!</p>