SyntaxFix
Write A Post
Hire A Developer
Questions
Here's another data.table solution, since which.max does not work on characters
data.table
which.max
library(data.table) group <- data.table(Subject=ID, pt=Value, Event=Event) group[, .SD[order(pt, decreasing = TRUE) == 1], by = Subject]