Using data.table:
(Edited to reflect @Frank’s comments)
DT[, Benchmark := Value[Category == "Time"][which.min(Number[Category == "Time"])], by = FileName]
Breaking this down:
Number[Category == "Time"]
- Take all
Number
whereCategory == Time
which.min(^^^)
- Find which one is the minimum
Benchmark := Value[Category == "Time"][^^^]
- Set the new column of benchmark to the value at this minimum
by = FileName
- Do this by group
23
solved Selecting a unique value from an R data frame