[R] coef(summary) and plyr

Hadley Wickham hadley at rice.edu
Mon Aug 9 18:47:51 CEST 2010


> 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/



More information about the R-help mailing list