On Monday, November 26, 2012, Sam Steingold wrote: [snip] > > there is precisely one country for each id. > i.e., unique(country) is the same as country[1]. > thanks a lot for the suggestion! > > > R> result <- f[, list(min=min(delay), max=max(delay), > > count=.N,country=country[1L]), by="share.id"]
And is it performant? 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"] > -- > Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X > 11.0.11103000 > http://www.childpsy.net/ http://thereligionofpeace.com http://pmw.org.il > http://honestreporting.com http://americancensorship.org > Why do you never call me back after I scream that I will never talk to you > again?! > -- 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 [[alternative HTML version deleted]] ______________________________________________ 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.