The *apply and map* functions will loop on the columns of a data.frame, making it quite easy.
ex_df <- tribble(~qu1, ~qu2, ~qu3,
4, 5, 1,
1, 4, 1,
1, 4, 2,
1, 2, 2,
NA, 3, 2,
2, 5, 1,
6 , 5, 2,
2 , 5, 3,
1 , 4, 1,
NA , 3, 1,
4 , 2, 1,
2 , 2, 2,
3 , 4, 3,
3 , 3 , 3)
map_lgl(ex_df, ~any(is.na(.)))
# qu1 qu2 qu3
# TRUE FALSE FALSE
Or you can force the output to be integer with map_int().
Base R equivalent:
sapply(ex_df, function(x) 1L*any(is.na(x)))
Multiplying by 1L (the integer 1) converts to integer.