> There is one further improvement to consider. When I tried using dlply to > tackle a problem on which I had been bashing my head for the last three days > and it gave just the results I had been looking for, I also noticed that the > dlply function returns the grouping variable levels in an attribute, > "split_labels", which could be unlisted to use as an argument to the rep() > call I suggested earlier: > > dfdl$group=rep(unlist(attr(dl, "split_labels")), each=4) > > That might make the results more self-documenting in situations where the > grouping levels were more involved than 0:2.
That's exactly what dlply does - so you should never have to do that yourself. Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/ ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.