[R] aggregate() runs out of memory
Steve Lianoglou
mailinglist.honeypot at gmail.com
Mon Nov 19 22:30:03 CET 2012
Hi,
On Mon, Nov 19, 2012 at 1:25 PM, Sam Steingold <sds at gnu.org> wrote:
> Thanks Steve,
> what is the analogue of .N for min and max?
> i.e., what is the data.table's version of
> aggregate(infl$delay,by=list(infl$share.id),FUN=min)
> aggregate(infl$delay,by=list(infl$share.id),FUN=max)
> thanks!
It would be helpful if I could see a bit of your table (like
`head(infl)`, if it's not too big), but anyway: there is no real
analogue of min/max -- you just use them
For instance, if you want the min and max of `delay` within each group
defined by `share.id`, and let's assume `infl` is a data.frame, you
can do something like so:
R> as.data.table(infl)
R> setkey(infl, share.id)
R> result <- infl[, list(min=min(delay), max=max(delay)), by="share.id"]
HTH,
-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