I have the following data:
df <- data.frame(A = c(1,2,3,4,5,6), B=c(\"P\",\"P\",\"P\",\"Q\",\"Q\",\"Q\"), C=c(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\")) df ##
you can also use the split-apply technique:
# split `df` on the field 'b' tmp <- split(df,df$B) # reduce to the row with the minimum value of A tmp <- lapply(tmp,function(x) x[x$A == min(x$A),]) # bind the rows together do.call(rbind,tmp) #> A B C #> P 1 P a #> Q 4 Q d