Hello Ben, What about ordering on group+date descending, then removing duplicated on group ?
someting like : DT[!duplicated(Group),][order(Group,asDate(Date,format="yourFormat"),decreasing=T)] Le 19/07/2014 00:40, bgoldstein a écrit : > I am having trouble defining (and therefore searching) for this problem. I > have data like this: > > Group Value Date > 1 xxx June > 1 yyy July > 2 zzzz May > 2 qqqq August > etc. > > > I want to subset the 'Value' of each 'Group' by the latest 'Date'. So my > output should be: > > Group Value Date > 1 yyy July > 2 qqqq August > etc. > > The doBy package has a firstobs() function that works but is quite slow. > > What would be a data.table way to do this? > > Thank you, > > Ben > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/Subsetting-By-Row-Function-tp4694221.html > Sent from the datatable-help mailing list archive at Nabble.com. > _______________________________________________ > datatable-help mailing list > [email protected] > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help > _______________________________________________ datatable-help mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
