From maechler at stat.math.ethz.ch  Wed Feb 10 08:59:26 2010
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Wed, 10 Feb 2010 08:59:26 +0100
Subject: [Rd] Aggregate dataframe .. *inappropriate* for R-devel
In-Reply-To: <bb3f839b1002091400i11f85210nb93fefe01e71842c@mail.gmail.com>
References: <bb3f839b1002091400i11f85210nb93fefe01e71842c@mail.gmail.com>
Message-ID: <19314.26462.636614.717972@lynne.math.ethz.ch>

Not at all appropriate to be posted to R-devel :

>>>>> "vl" == violet lock <violetlock at gmail.com>
>>>>>     on Tue, 9 Feb 2010 17:00:48 -0500 writes:

    > Hello r-devel,
    > I have data.frame with 3 columns and I would like to group by 1 column(id),
    > find the max of the third column (date) and return the data for that max
    > date value along with the id and the value in the second column.

    > Example:
    >> dat <- data.frame(id = rep(1:3, 3), date = as.Date(rep(c("2005-08-25",
    > "2005-08-26", "2005-08-29"), each = 3)), decod = c("SCREEN", "SCREEN",
    > "SCREEN", "RAND", "RAND", "RAND", "COMPLETE", "COMPLETE", "WITHDRAWAL")  )


    > What I need is it to return is:


[...............]
[...............]


    > Any ideas would be appreciated,

E-mails that look like the above *CLEARLY* belong to  R-help
and *NEVER* to  R-devel.

Please read the posting guide
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.

and *then* repost to R-help!

Martin Maechler, ETH Zurich



[Rd] Aggregate dataframe .. *inappropriate* for R-devel
Martin Maechler