How to create a new variable that is the sum of a column, by group, in R?

后端 未结 0 411
臣服心动
臣服心动 2021-01-05 03:54

I am trying to create a new variable in my dataframe that is the group-specific sum of a variable. For example:

df <- data.frame (group  = c(1, 1, 1, 2, 2,         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题