I have the following data frame but in a bigger scale of course:
| country | year | strain | num_cases | 
|---|---|---|---|
| mex | 1996 | sp_m014 | 412 | 
| mex | 1996 | sp_f014 | 214 | 
| mex | 1998 | sp_m014 | 150 | 
| mex | 1998 | sp_f014 | 200 | 
| usa | 1996 | sp_m014 | 200 | 
| usa | 1996 | sp_f014 | 180 | 
| usa | 1997 | sp_m014 | 190 | 
| usa | 1997 | sp_f014 | 150 | 
I want to get the following result, that is the sum of sp_m014 (male) and sp_f014 (female) for mex and usa individually:
| country | year | strain | num_cases | 
|---|---|---|---|
| mex | 1996 | sp | 626 | 
| mex | 1998 | sp | 350 | 
| usa | 1996 | sp | 380 | 
| usa | 1997 | sp | 340 | 
In my real data frame I have a lot more age ranges, here I only show the 014 for males and females. But I want to summarize them that way for every age range and gender.
Thanks!
 
     
     
    