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

Martin Maechler maechler at stat.math.ethz.ch
Wed Feb 10 08:59:26 CET 2010


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



More information about the R-devel mailing list