So I have a data frame such as this:
A_count | B_count
0 | 0
312 | NA
2 | 23
0 | 2
NA | NA
13 | 0
I want to create a third column that checks whether at least one of these columns has a value that isn't 0 or NA. So I tried:
df<-df %>%
mutate(new_column= ifelse(A_count>0 | B_count > 0, "yes","no"))
So, if either of them is more than 0, then the new column should have "yes", and all other cases should be "no" (i.e. the zeros and NAs). But the result I'm getting isn't exactly that because I'm getting NAs in the new column and I'm not getting any "no"s. I'm guessing it's the NAs that are messing it up, but I'm not sure. Thanks in advance for any answer