I\'m trying to calculate the minimum values of a numeric column for each level of a factor, while keeping values of another factor in the resulting data frame.
If you had added in the index variable that would have done it.
library(plyr) # ddply ddply(dat, .(code,index), summarise, val = min(value)) # base R aggregate(value ~ code + index, dat, min)