📜  r first row by group - R 编程语言代码示例

📅  最后修改于: 2022-03-11 14:51:58.853000             🧑  作者: Mango

代码示例1
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)