[R] Aggregate with Function List ?

Gabor Grothendieck ggrothendieck at gmail.com
Wed Mar 7 16:59:47 CET 2012

On Wed, Mar 7, 2012 at 10:36 AM, Michael Karol <MKarol at syntapharma.com> wrote:
> All:
> It now appears to be working; however, I have a new problem.  The format of the output is not what I need.  Currently it produces an output as three columns; "Group.1", "Group.2", and "x"
> whereas I need a data frame with columns of Day, Hour, mean, sd, median, min, max.
> Interestingly, the output appears on the console looking like the data frame I need with 7 columns, but internally it only has 3.
> I'm using R version 2.14.0 (2011-10-31)

The third column is a 5 column matrix.  You can flatten this using one
of these if the nested structure is not wanted:

# data.frame
do.call("data.frame", MeansByDayTime)

# matrix
do.call("cbind", MeansByDayTime)

Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

More information about the R-help mailing list