Hi, On Tue, Nov 27, 2012 at 11:29 AM, Sam Steingold <s...@gnu.org> wrote: >> * Steve Lianoglou <znvyvatyvfg.ubarl...@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 ______________________________________________ R-help@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.