I would like to do a sommation of durations in R in order to get a total one.
My data frame (simplified) looks like this:
Name | Job # | Job duration |
---|---|---|
John | 1 | 10 |
John | 2 | 5 |
Mary | 1 | 30 |
Bob | 1 | 7 |
Bob | 2 | 7 |
Bob | 3 | 7 |
So, in this case, I would like to create a new variable like data$job_duration_total. For this variable, John would have a job_duration_total = 15, Mary = 30 and Bob = 21
I tried using the sum function, without success.
Any help you can provide in helping me understand is greatly appreciated!