I have a data frame DF with four fields: id, date, feature, value
. I would like to generate a data frame DF2 with three fields: id, feature, value
, where value
is the value for the corresponding id
and feature
for the latest available date
. In plyr parlance:
DF2 <- ddply(DF, .(id, feature), function(x) c(value(x$value[x$date == max(x$date)]))
I am a bit at a loss on how to achieve this with dplyr using group_by and summarize.