[R] by class...
David Winsemius
dwinsemius at comcast.net
Fri Dec 20 19:27:56 CET 2013
On Dec 20, 2013, at 9:45 AM, David Winsemius wrote:
>
> On Dec 20, 2013, at 9:38 AM, Onur Uncu wrote:
>
>> I used the by() function on a data.frame to get sums of the data grouped by 2 factors. The function worked however the output is in a class called 'by'. Not familiar with this class. How can I turn the output into a nice table where columns represent values of factor1, row represent values of factor2 and the entries in the table are the sums that were calculated using the by function?
>>
>> I did some web search which suggested using do.call(rbind, datframe_object) but this command gave the following error:
>> "Second argument must be a list"...
>
> The output of by() is always a list, so I would have expected:
Or maybe my memories are false.
?by
"This is always a list if simplify is false, otherwise a list or array (see tapply)."
So maybe you need simplify=FALSE
>
> do.call(rbind, by.object) to have retruned a different error message that what you suggest.
>
>
>>
>>
>> Thank you.
>> ______________________________________________
>> R-help at 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.
>
> David Winsemius
> Alameda, CA, USA
>
> ______________________________________________
> R-help at 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.
David Winsemius
Alameda, CA, USA
More information about the R-help
mailing list