On Wed, May 6, 2009 at 8:12 PM, jim holtman <jholt...@gmail.com> wrote: > Ths should do it: > >> do.call(rbind, lapply(split(x, x$ID), tail, 1)) > ID Type N > 45900 45900 I 7 > 46550 46550 I 7 > 49270 49270 E 3
Or with plyr: library(plyr) ddply(x, "id", tail, 1) plyr encapsulates the common split-apply-combine strategy and takes cares of the details for you. Read more about it on http://had.co.nz/plyr Hadley -- http://had.co.nz/ ______________________________________________ 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.