The interesting thing about R is that there are several ways to "skin the cat"; here is yet another solution:
> do.call(rbind, by(ddTable, ddTable$Id, function(z) z[1,,drop=FALSE])) Id name 1 1 Paul 2 2 Bob > On Fri, Jun 6, 2008 at 9:35 AM, Emslie, Paul [Ctr] <[EMAIL PROTECTED]> wrote: > I want to take the first row of each unique ID value from a data frame. > For instance > > ddTable <- > data.frame(Id=c(1,1,2,2),name=c("Paul","Joe","Bob","Larry")) > > I want a dataset that is > Id Name > 1 Paul > 2 Bob > > > unique(ddTable) > Will give me all 4 rows, and > > unique(ddTable$Id) > Will give me c(1,2), but not accompanied by the name column. > > ______________________________________________ > 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<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? [[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.