0

I have a dataframe with three columns: Batch, Trial, Time.

Five Trials (0-4) are ran for each Batch number.

I want to pull out the row with the smallest time from each Batch and put them into a new dataframe.

I'm not sure where to start.

enter image description here

A5C1D2H2I1M1N2O1R2T1
  • 190,393
  • 28
  • 405
  • 485
bob
  • 55
  • 1
  • 4
  • See this one too: [how to efficiently select rows with minimum value in R?](http://stackoverflow.com/questions/13499430/how-to-efficiently-select-rows-with-minimum-value-in-r) – Backlin Oct 23 '13 at 07:04

1 Answers1

0

Assuming the dataframe as df.

Try
df.new <- df[ df$Time == ave(df$Time, df$Batch, FUN=min), ])
Kumar
  • 314
  • 3
  • 5
  • 16