Skip to content
Prev 172210 / 398506 Next

ave and grouping

Try performing ave over the indexes rather than over extra itself:

sleep$newcol <-
  with(sleep, ave(1:nrow(sleep), group, FUN = function(ix) extra[b[ix][1]]))

On Mon, Mar 2, 2009 at 4:28 AM, Patrick Hausmann
<Patrick.Hausmann at uni-bremen.de> wrote: