更新时间:2023-12-01 17:28:46
这就是 ave 函数的用途.
ave
This is what the ave function is for.
df1$Y.New <- ave(df1$Y, df1$X)
按组向原始数据添加一列均值