[R] Aggregate by minimum

Jeffrey Joh
Tue, 10 Jan 2012 01:23:41 -0000

For each date, I would like to keep the line with the lowest speed and discard
the rest.  The result would have one line for each date.  Can I use aggregate
for this?

My table is as follows:
structure(list(speed = c(3,9,14,8,7,6), result = c(0.697, 0.011, 0.015, 0.012,
0.018, 0.019), house = c(1,
1, 1, 1, 1, 1), date = c(719, 1027, 1027, 1027, 1030, 1030),
    id = c("1000", "10000",
    "10001", "10002", "10003",
"10004")), .Names = c("speed",
"result", "house", "date", "id"), class
= "data.frame", row.names = c("1000",
"10000", "10001", "10002", "10003",
"10004"))

Thanks,
Jeffrey


	[[alternative HTML version deleted]]