How to group by two columns in R

前端 未结 2 1920
孤街浪徒
孤街浪徒 2020-12-03 05:44

I have a data frame that I am trying to group and then sum based on two columns. The two columns are characters with one being month and the other variable.

The foll

2条回答
  •  清歌不尽
    2020-12-03 06:04

    ... or, you can use an alternative sintax:

    summarise(group_by(df, variable), sum(amount), mean(amount))
    

    Enjoy.

提交回复
热议问题