idvalues <- data.frame (ID = c(1, 1, 2, 2, 3, 4, 4, 4, 5, 5), Value = c(0.69, 0.31, 0.01, 0.99, 1.00, NA, 0,1, 0.5, 0.5)) aggregate(Value~ID, data=idvalues, max) ID Value 1 1 0.69 2 2 0.99 3 3 1.00 4 4 1.00 5 5 0.50 -- Best, GG [[alternative HTML version deleted]]