I am trying to create a rowsum in a df as in example:
df1
Name Ch1 Val1
A a x1
A a x2
A b x3
B c x4
B c x5
B d x6
...
to
df2
Name Ch1 Val1
A a x1+x2
A b x3
B c x4+x5
B d x6
...
I want to get the rowsum of Val1 (numeric!) where Ch1 (character) is unique according to Name (character)! I know I can join Name and Ch1 then do rowsum and then spread it again but is there a more elegant way to do this?
Thanks!