How can I apply different aggregate functions to different columns in R?
问题 How can I apply different aggregate functions to different columns in R? The aggregate() function only offers one function argument to be passed: V1 V2 V3 1 18.45022 62.24411694 2 90.34637 20.86505214 1 50.77358 27.30074987 2 52.95872 30.26189013 1 61.36935 26.90993530 2 49.31730 70.60387016 1 43.64142 87.64433517 2 36.19730 83.47232907 1 91.51753 0.03056485 ... ... ... > aggregate(sample,by=sample["V1"],FUN=sum) V1 V1 V2 V3 1 1 10 578.5299 489.5307 2 2 20 575.2294 527.2222 How can I apply a