[R] how to convert by lists in data.frames

2012-10-09 Thread Jesus Frias
Dear R-helpers, I’ve got a summary of results from a by() call that I am making with a list of more than two of factors not very different from the example in the by() help page require(stats) by(warpbreaks[, 1], warpbreaks[, -1], summary) The result of the command gives a

Re: [R] how to convert by lists in data.frames

2012-10-09 Thread Rui Barradas
Hello, Try do.call(data.frame, by.list) Hope this helps, Rui Barradas Em 09-10-2012 17:53, Jesus Frias escreveu: Dear R-helpers, I've got a summary of results from a by() call that I am making with a list of more than two of factors not very different from the example in the by()

Re: [R] how to convert by lists in data.frames

2012-10-09 Thread ilai
On Tue, Oct 9, 2012 at 11:42 AM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, Try do.call(data.frame, by.list) I don't think data.frame inside do.call works in this context. May need it on the outside to do the job (Only OK here since there is no mixture of numeric and character/factors

Re: [R] how to convert by lists in data.frames

2012-10-09 Thread Bert Gunter
Ilai, et. al: Yes. The OP might also look at the result of: t(simplify2array (by.list)) 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

Re: [R] how to convert by lists in data.frames

2012-10-09 Thread ilai
On Tue, Oct 9, 2012 at 12:25 PM, Bert Gunter gunter.ber...@gene.com wrote: 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

Re: [R] how to convert by lists in data.frames

2012-10-09 Thread Rui Barradas
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: On Tue, Oct 9, 2012 at 12:25 PM, Bert Gunter