I have a dataset, that, to make it easier I have simplified like this...
Group, Type, Quantity
1, A, 5
1, B, 8
1, C, 9
1, D, 10
2, A, 7
2, B, 6
2, C, 4
2, E, 5
Is there a way for me to add Quantity by Type but grouped by Group? Meaning, is there a way for me to add all instances of quantity for C to quantity for B but grouped by Group? So is there a way for the dataset to look like this? I know I need to use map (purr) or across (dplyr), but I can't seem to figure it out. Thanks.
Group, Type, Quantity
1, A, 5
1, B + C, 8 + 9 = 17
1, D, 10
2, A, 7
2, B + C, 6 + 4 = 10
2, E, 5