Using filter() with across() to keep all rows of a data frame that include a missing value for any variable

In the same article you mention ( tidyverse website ) there is 'a trick' with the rowSums function. You can use that as :

rowAny <- function(x) rowSums(x) > 0 
df %>% 
     filter(rowAny(
         across(
             .cols = everything(),
             .fns = ~ is.na(.x)
         )
     )
)
3 Likes