Apply multiple functions to column using tapply

后端 未结 2 1112
醉梦人生
醉梦人生 2020-12-09 22:56

Could someone please point to how we can apply multiple functions to the same column using tapply (or any other method, plyr, etc) so that the result can be obtained in dist

2条回答
  •  盖世英雄少女心
    2020-12-09 23:27

    ddply() is conceptually the clearest, but sometimes it is useful to use tapply instead for speed reasons, in which case the following works:

    do.call( rbind, tapply(df$MoneySpent, df$User, f) )
    

提交回复
热议问题