Skip to content
Prev 82798 / 398506 Next

Labeling a range of bars in barplot?

Note that if I follow this correctly then you could remove the loop.   In
particular note that 1. st is just the cumulative sum of new.break.points
but summed from the end:

   st <- rev(cumsum(rev(my.new.breaks)))

2. segments and text both take vector arguments and 3. averaging over the
groups can be done by defining a factor g whose levels are the groups
using cut and then performing the averaging with tapply:

   g <- cut(seq(mp), c(1, st.), include.lowest = TRUE)
   tapply(mp, g, mean)
On 12/14/05, Dan Bolser <dmb at mrc-dunn.cam.ac.uk> wrote: