In R:
I am not sure what the proper title for this question is, so maybe someone can help me out. It would be greatly appreciated. I'm sorry if this is called something easily searchable.
So I have a ragged array matrix (multiple UPCS)
[upc] [quantity] [day] [daysum]
[1] 123 11 1 NA
[2] 123 2 1 NA
[3] 789 5 1 NA
[4] 456 10 2 NA
[5] 789 6 2 NA
I want the matrix to be summed by UPC for each day, for example:
[upc] [quantity] [day] [daysum]
[1] 123 11 1 13
[2] 123 2 1 13
[3] 789 5 1 5
[4] 456 10 2 10
[5] 789 6 2 6
Thank you for your time and help.