Let\'s say I have four samples: id=1, 2, 3, and 4, with one or more measurements on each of those samples:
> a <- data.frame(id=c(1,1,2,2,3,4), value=c
library(plyr) ddply(a, .(id), function(x) return(x[which(abs(x$value)==max(abs(x$value))),]))