By using R studio, I have a data set like this:
ID location Bouns
1  A        yes
2  A        yes
3  B        no
4  C        yes
...
If I want to add a column by using mutate or summarize, It called 'cases' to count how many 'yes' appears in bouns base on location. For example like this
ID location Bouns cases
1  A        yes   2
2  A        yes   2
3  B        no    0
4  C        yes   1
as long as there are 2 'yes' on location A
 
     
     
    