I have a data.frame
with this structure:
id time var1 var2 var3
1 2 4 5 6
1 4 8 51 7
1 1 9 17 38
2 12 8 9 21
2 15 25 6 23
For all the ids, I want to have the row that contains the minimum time. In the example in would be this:
id time var1 var2 var3
1 1 9 17 38
2 12 8 9 21
I think that the aggregate
function would be useful, but I'm not sure how to use it.