data <- tibble::tibble(
x = c(TRUE, FALSE, NA),
y = c("x is false", NA, "x is false")
)
dplyr::mutate(data,
x1 = tidyr::replace_na(x, FALSE),
x3 = if_else2(is.na(x) & y == "x is false", FALSE, x),
x4 = replace_na_if(x, y == "x is false", FALSE)
)
Run the code above in your browser using DataLab