[R] aggregate() runs out of memory
Steve Lianoglou
mailinglist.honeypot at gmail.com
Tue Nov 27 18:53:23 CET 2012
Hi,
On Tue, Nov 27, 2012 at 11:29 AM, Sam Steingold <sds at gnu.org> wrote:
>> * Steve Lianoglou <znvyvatyvfg.ubarlcbg at tznvy.pbz> [2012-11-26 19:47:25 -0500]:
[snip]
>> It just occurred to me that this is even better:
>>
>> R> setkeyv(f, c("share.id", "delay"))
>> R> result <- f[, list(min=delay[1L], max=delay[.N], count=.N,
>> country=country[1L]), by="share.id"]
>>
>
> this assumes that delays are sorted (like in my example)
> which, in reality, they are not.
> thanks for your help!
When you include "delay" in the call to `setkeyv` as I did above, it
sorts low to high w/in each "share.id" group.
-steve
--
Steve Lianoglou
Graduate Student: Computational Systems Biology
| Memorial Sloan-Kettering Cancer Center
| Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
More information about the R-help
mailing list