Skip to content

how to convert by lists in data.frames

6 messages · Jesus Frias, Rui Barradas, ilai +1 more

#
Ilai, et. al:

Yes. The OP might also look at the result of:
The only wrinkle here (with either rbind or simplify2array) is getting
the labels correct if the design is not fully crossed -- i.e. if some
groups are missing so that expand.grid() won't work. Then you might
have to work harder to extract the information from by.list.
might help here.

-- Bert
On Tue, Oct 9, 2012 at 11:14 AM, ilai <keren at math.montana.edu> wrote:

  
    
#
You're right, I was in a hurry. This one works.

x <- rnorm(100)
a <- sample(letters[1:4], 100, T)
by.list <- by(x, a, summary)

do.call(rbind, as.list(by.list))


(I would also prefer aggregate.)

Rui Barradas


Em 09-10-2012 19:46, ilai escreveu: