Update: A bit more digging and I found duplicated() (
http://tolstoy.newcastle.edu.au/R/e4/help/08/06/13592.html).  Sorry for the
premature request for help!


On Mon, Feb 4, 2013 at 6:29 PM, Dylan Arena <dar...@stanford.edu> wrote:

> Hi there,
>
>
> I have data frame with columns ID and Date.  There are multiple rows for
> each ID, but I only want to keep the *first* such row--i.e., the row
> corresponding to the earliest event.  So if I had, say, 1000 rows of 100
> IDs doing an average of ten events each, I'd run this trimming procedure
> and end up with a data frame containing 100 rows (one for each ID), where
> each row record that ID's first event.
>
> I can think of slow, clumsy, for-loop ways to trim the data frame, but I'm
> hopeful that there is some slick "R" way to do it that someone here can
> help me find.  But so deep is my ignorance that I can't even come up with
> useful search terms to use on Rseek.org (I investigated "merge" but had no
> luck there).
>
>
> Grateful for any ideas/tips/pointers,
> Dylan
>
>

        [[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.

Reply via email to