Hi, On Mon, Nov 19, 2012 at 1:25 PM, Sam Steingold <[email protected]> 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 ______________________________________________ [email protected] 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.

