Trying to Drop NA Rows which fulfill condition df$e == 'a'
c <- c(1,2,3,4)
b <- c(NA,NA,NA,'f')
e <- c('e','a','e','a')
df <- tibble(c,b,e)
# A tibble: 4 x 3
c b e
<dbl> <lgl> <chr>
1 1 NA e
2 2 NA a
3 3 NA e
4 4 f a
trying to get:
# A tibble: 4 x 3
c b e
<dbl> <lgl> <chr>
1 1 NA e
3 3 NA e
4 4 f a
I have tried variations of df <- which(df$e == 'a' & is.na(df$b) == TRUE)
and df %>% ifelse(df$e == 'a', drop_na('b'))
with no success.