I have the following data frame df:
LoB AY DY claims paid
2 2002 0 1 652
2 2004 0 1 0
2 2005 0 1 0
2 2002 1 0 0
2 2004 1 0 0
2 2002 2 0 0
2 2002 3 0 0
I want to delete rows of the same AY if the sum of their df$paid is 0. Here, there are 2 rows containing AY=2004 and adding their corresponding "paid" values results to 0. Same with AY=2005. I want such rows removed. I am aiming for the following result:
LoB AY DY claims paid
2 2002 0 1 652
2 2002 1 0 0
2 2002 2 0 0
2 2002 3 0 0
How do I do this?