I am having trouble filtering my dataframe which is the following:
df <- data.frame(A = c("q","q","z","z","v","v"),
B = c("a","b","a","b","b","a"),
C = c( 10, 12, 5, 0, 0, 0))
Now I do want to get rid of the 0s since they mean NA, but only if both values for a value in A are so. So I do want to keep both Zs but want to get rid of both Vs. This is my desired output:
A B C
q a 10
q b 12
z a 5
z b 0
However i can only get it to show this(with all 0 values included):
A B C
q a 10
q b 12
z a 5
z b 0
v b 0
v a 0
Or with Bs 0 value removed aswell. I already tried removing values below 0 but this removed the z value aswell, which I need for my analysis.
How can I get the desired output?