📅  最后修改于: 2022-03-11 14:51:58.853000             🧑  作者: Mango
df <- data.frame(group=c("a", "b"), value=1:8)
## Order the data frame with the variable of interest
df <- df[order(df$value),]
## Aggregate
aggregate(df, list(df$group), FUN=head, 1)