# Example data
dat <- tibble::tibble(
a = c(1, NA, 3),
b = c(NA, NA, 2),
c = c(1, 2, 3),
out = c(10, 11, 12)
)
# Assign NA to out when all of a and b are NA
check_assign_na(
dat,
output = "out", input = c("a", "b"), allow_missingness = TRUE
)
# Assign NA to out when any of a and b are NA
check_assign_na(
dat,
output = "out", input = c("a", "b"), allow_missingness = FALSE
)
Run the code above in your browser using DataLab