I have the following df, with redundant column3 values "bbb" and "ddd"
col1 col2 col3
u1 1 aaa
u1 1 bbb
u1 1 bbb
u1 1 bbb
u1 1 ccc
u1 -1 ddd
u1 -1 ddd
I wish to create the following df, where col3-redundant rows are replace by a single row with col2 = SUM of replaced rows:
col1 col2 col3
u1 1 aaa
u1 3 bbb
u1 1 ccc
u1 -2 ddd
Thanks in advance
Try
Or using
data.table
Or using
sqldf
Or using
base R